hiho week 223 register

Ended

Participants:148

Verdict:Accepted
Score:100 / 100
Submitted:2018-10-13 19:16:16

Lang:Python2

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
NXY = map(intraw_input().split())
a = sorted([map(intraw_input().split()) for i in range(N)])
ret = 0
i = 0
x = y = X
while i < N:
    if y >= Y:
        break
    if a[i][1] <= x:
        i += 1
        continue
    if a[i][0] > x:
        print -1
        exit()
    while a[i][0] <= x:
        y = max(ya[i][1])
        i += 1
    ret += 1
    x = y
print ret
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX