We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6514105 commit adc6da5Copy full SHA for adc6da5
Python_BOJ_2023/10815.py
@@ -0,0 +1,28 @@
1
+# 숫자 카드
2
+
3
+n = int(input())
4
+arr1 = list(map(int, input().split()))
5
+arr1.sort()
6
+m = int(input())
7
+arr2 = list(map(int, input().split()))
8
9
+def bin_search(target):
10
+ global n, m, arr1
11
+ start, end = 0, n - 1
12
13
+ while start <= end:
14
+ mid = (start + end) // 2
15
+ if arr1[mid] == target:
16
+ return True
17
18
+ if arr1[mid] < target:
19
+ start = mid + 1
20
+ elif arr1[mid] > target:
21
+ end = mid - 1
22
+ return False
23
24
+for i in range(m):
25
+ if bin_search(arr2[i]):
26
+ print(1)
27
+ else:
28
+ print(0)
0 commit comments