We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bfde30d commit 57ec8adCopy full SHA for 57ec8ad
1 file changed
live11/test114/문제2/박희경.py
@@ -10,14 +10,18 @@
10
radius.append((x-r, x+r))
11
12
radius.sort()
13
+
14
flag = 'YES'
-for i in range(len(radius) - 1):
15
- if radius[i][0] < radius[i+1][0]:
16
- if radius[i][1] > radius[i+1][1]: # 안에 있는 경우
17
- continue
18
- else:
+stack = []
+for start, end in radius:
+ if not stack:
+ stack.append((start, end))
19
+ else:
20
+ pre_start, pre_end = stack.pop()
21
+ if pre_start >= start or pre_end == start: # 맞닿아 있을 때
22
flag = 'NO'
- if radius[i][1] < radius[i+1][0]:
-
23
-print(flag)
+ break
24
+ if pre_end > start and pre_end <= end: # 겹칠 때
25
+ flag = 'NO'
26
27
+print(flag)
0 commit comments