Submission #9565486


Source Code Expand

Copy
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from operator import itemgetter

# 区間スケジューリング

N = int(readline())
m = map(int,read().split())
XL = zip(m,m)

LR = [(x-l,x+l) for x,l in XL]
LR.sort(key = itemgetter(1))

INF = 10 ** 18
prev_R = -INF
cnt = 0
for L,R in LR:
    if prev_R > L:
        continue
    cnt += 1
    prev_R = R

print(cnt)

Submission Info

Submission Time
Task B - Robot Arms
User maspy
Language Python (3.4.3)
Score 200
Code Size 460 Byte
Status AC
Exec Time 168 ms
Memory 27800 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 16
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 160 ms 27488 KB
02.txt AC 168 ms 27800 KB
03.txt AC 164 ms 27404 KB
04.txt AC 163 ms 27536 KB
05.txt AC 155 ms 26736 KB
06.txt AC 164 ms 27568 KB
07.txt AC 159 ms 26760 KB
08.txt AC 80 ms 14752 KB
09.txt AC 80 ms 14720 KB
10.txt AC 81 ms 15296 KB
11.txt AC 157 ms 27496 KB
12.txt AC 157 ms 27544 KB
13.txt AC 18 ms 3064 KB
sample-01.txt AC 18 ms 3064 KB
sample-02.txt AC 18 ms 3060 KB
sample-03.txt AC 18 ms 3064 KB