Submission #636770

# Submission time Handle Problem Language Result Execution time Memory
636770 2022-08-30T06:42:23 Z beaconmc Strange Device (APIO19_strange_device) PyPy 3
0 / 100
2746 ms 245900 KB
n,a,b = map(int, input().split())

ranges = []
for i in range(n):
    ranges.append(list(map(int, input().split())))
newranges = []
flag = False
for i in range(n):
    ranges[i] = [ranges[i][0]%(a*b), ranges[i][1]%(a*b)]
    if ranges[i][0]>ranges[i][1]:
        
        newranges.append([ranges[i][0]%(a*b),a*b])
        newranges.append([0,ranges[i][1]%(a*b)])
    else:
        newranges.append(ranges[i])
        
newranges.sort()
if newranges[0][0]==0 and newranges[-1][-1]==a*b:
    flag = True
ans = 0
cur = a*b
while newranges:
    sus = newranges.pop()
    ans += min(cur,sus[1])-sus[0]+1
    cur = sus[0]-1
print(ans-flag)
# Verdict Execution time Memory Grader output
1 Correct 38 ms 18136 KB Output is correct
2 Incorrect 118 ms 25400 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 18180 KB Output is correct
2 Incorrect 35 ms 18196 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 18220 KB Output is correct
2 Incorrect 83 ms 19704 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 18120 KB Output is correct
2 Correct 2641 ms 245900 KB Output is correct
3 Incorrect 2746 ms 245744 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 18120 KB Output is correct
2 Correct 2641 ms 245900 KB Output is correct
3 Incorrect 2746 ms 245744 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 18120 KB Output is correct
2 Correct 2641 ms 245900 KB Output is correct
3 Incorrect 2746 ms 245744 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 18184 KB Output is correct
2 Correct 342 ms 42752 KB Output is correct
3 Correct 343 ms 42752 KB Output is correct
4 Correct 2699 ms 241304 KB Output is correct
5 Correct 323 ms 42604 KB Output is correct
6 Correct 318 ms 42660 KB Output is correct
7 Correct 340 ms 42644 KB Output is correct
8 Correct 349 ms 42628 KB Output is correct
9 Correct 329 ms 42548 KB Output is correct
10 Correct 319 ms 42628 KB Output is correct
11 Correct 350 ms 42588 KB Output is correct
12 Correct 334 ms 42656 KB Output is correct
13 Correct 321 ms 42548 KB Output is correct
14 Incorrect 2524 ms 241952 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 18136 KB Output is correct
2 Incorrect 118 ms 25400 KB Output isn't correct
3 Halted 0 ms 0 KB -