hiho week 223 register

Ended

Participants:148

Verdict:Wrong Answer
Score:10 / 100
Submitted:2018-10-07 10:55:24

Lang:Python2

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
line1 = raw_input().split()
n = int(line1[0])
xy = [int(x)for x in line1[1:]]
linent = []
for i in range(n):
    linent.append([int(y) for y in raw_input().split()])
linen = sorted(linent)
x = xy[0];y = xy[1]
R = []
c = 1
if xy in linen:
    print(1)
else:
    if linen[0][0] <= x:
        x0 = linen[0][0]
        s = 0
        while True:
            R0t = []
            R0t = [r for r in linen[c-1:] if r[0]<=x0]
            R0 = sorted(R0t,key=lambda r:r[1])
            if len(R0) != 0:
                c += len(R0)
                x0 = R0[-1][1]
                R.append(x0)
                if x0>=y:
                    print(len(R))
                    break
            else:
                print(-1)
                break
    else:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX