Submission #23270858
Source Code Expand
N=int(input())
A = []
for _ in range(N):
x,l=map(int,input().split())
s = x - l
t = x + l
A.append( (s, t) )
A.sort(key=lambda x:x[1])
cur = -float("inf")
cnt = 0
for s, t in A:
if cur <= s:
cur = t
cnt += 1
print(cnt)
Submission Info
| Submission Time | |
|---|---|
| Task | B - Robot Arms |
| User | lightning |
| Language | Python (3.8.2) |
| Score | 200 |
| Code Size | 274 Byte |
| Status | AC |
| Exec Time | 299 ms |
| Memory | 23896 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample-01.txt, sample-02.txt, sample-03.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, sample-01.txt, sample-02.txt, sample-03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 299 ms | 23756 KiB |
| 02.txt | AC | 293 ms | 23824 KiB |
| 03.txt | AC | 298 ms | 23768 KiB |
| 04.txt | AC | 282 ms | 23896 KiB |
| 05.txt | AC | 268 ms | 23708 KiB |
| 06.txt | AC | 282 ms | 23892 KiB |
| 07.txt | AC | 265 ms | 23604 KiB |
| 08.txt | AC | 146 ms | 16372 KiB |
| 09.txt | AC | 143 ms | 16504 KiB |
| 10.txt | AC | 143 ms | 16328 KiB |
| 11.txt | AC | 297 ms | 23788 KiB |
| 12.txt | AC | 274 ms | 23604 KiB |
| 13.txt | AC | 18 ms | 8968 KiB |
| sample-01.txt | AC | 23 ms | 9012 KiB |
| sample-02.txt | AC | 22 ms | 8852 KiB |
| sample-03.txt | AC | 18 ms | 8852 KiB |