We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6b50631 + 6e19f04 commit 9f1665eCopy full SHA for 9f1665e
2 files changed
live12/test123/문제1/백한결.py
@@ -0,0 +1,29 @@
1
+import sys
2
+
3
+def main():
4
+ input = sys.stdin.readline
5
+ G = int(input())
6
+ P = int(input())
7
8
+ parent = [i for i in range(G+1)]
9
10
+ def find(x):
11
+ if parent[x] != x:
12
+ parent[x] = find(parent[x])
13
+ return parent[x]
14
15
+ count = 0
16
17
+ for _ in range(P):
18
+ g = int(input())
19
+ dockingGate = find(g)
20
21
+ if dockingGate == 0:
22
+ break
23
+ parent[dockingGate] = find(dockingGate - 1)
24
+ count += 1
25
26
+ print(count)
27
28
+if __name__ == '__main__':
29
+ main()
live12/test123/문제2/백한결.py
@@ -0,0 +1,12 @@
+ N = int(input())
+ for i in range(N):
+ x, y = map(int, input().split())
0 commit comments