We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f86ca32 commit 198e580Copy full SHA for 198e580
1 file changed
live8/test88/문제2/박희경.py
@@ -0,0 +1,32 @@
1
+import sys
2
+
3
+input = sys.stdin.readline
4
5
+n, m = map(int, input().split())
6
+a = list(map(int, input().split()))
7
+b = list(map(int, input().split()))
8
9
+res = []
10
+i, j = 0, 0
11
+while i < n and j < m:
12
+ if a[i] == b[j]:
13
+ res.append(a[i])
14
+ res.append(b[j])
15
+ i += 1
16
+ j += 1
17
+ elif a[i] < b[j]:
18
19
20
+ else:
21
22
23
24
+# 한쪽은 다 탐색했는데 한 쪽은 남았을 경우
25
+while i < n:
26
27
28
+while j < m:
29
30
31
32
+print(*res)
0 commit comments