Submission #10372548


Source Code Expand

Copy
INF = float("inf") #const

def main():
    n = int(input())
    ls = [list(map(int,input().split())) for _ in range(n)]
    #start ls[i][0] - ls[i][1]. goal ls[i][0] + ls[i][1]
    ls = sorted(ls,key = lambda x:x[0])

    ans = 0; t = -INF
    for i in range(n):
        if t <= ls[i][0] - ls[i][1]:
            ans += 1
            t = ls[i][0] + ls[i][1]
    print(ans)


if __name__ == "__main__":
    main()

Submission Info

Submission Time
Task B - Robot Arms
User sashimi334
Language Python3 (3.4.3)
Score 0
Code Size 430 Byte
Status
Exec Time 437 ms
Memory 29864 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
All 0 / 200 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 415 ms 29792 KB
02.txt 426 ms 29516 KB
03.txt 417 ms 29016 KB
04.txt 424 ms 28924 KB
05.txt 399 ms 26572 KB
06.txt 411 ms 26764 KB
07.txt 396 ms 29844 KB
08.txt 200 ms 16356 KB
09.txt 196 ms 16360 KB
10.txt 206 ms 16432 KB
11.txt 423 ms 29864 KB
12.txt 437 ms 29724 KB
13.txt 17 ms 3064 KB
sample-01.txt 17 ms 3064 KB
sample-02.txt 17 ms 3064 KB
sample-03.txt 17 ms 3060 KB