We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48c9bb6 commit 3e42809Copy full SHA for 3e42809
1 file changed
live12/test123/문제2/박희경.py
@@ -0,0 +1,21 @@
1
+import sys
2
+
3
+input = sys.stdin.readline
4
5
+n = int(input())
6
+lines = []
7
+for _ in range(n):
8
+ x, y = map(int, input().split())
9
+ lines.append([x, y])
10
11
+lines.sort()
12
13
+length = 0
14
+start, end = lines[0][0], lines[0][1]
15
+for i in range(1, n):
16
+ if lines[i][0] <= end and lines[i][1] <= end: # 완전 겹치는 경우
17
+ continue
18
+ elif lines[i][0] <= end and lines[i][1] > end: # 약간 겹치는 경우 (끝점이 더 길 경우)
19
+ end = lines[i][1]
20
+ else: # 안 겹치는 경우
21
+ length
0 commit comments