Submission #222715

# Submission time Handle Problem Language Result Execution time Memory
222715 2020-04-13T21:36:47 Z shart23 Strange Device (APIO19_strange_device) PyPy
0 / 100
28 ms 4960 KB
n, a, b = map(int, input().split())
k = a * b
seg = []
for i in range(n):
    l, r = map(int, input().split())
    if r - l + 1 >= k:
        seg.append([0, k - 1])
        continue
    l1 = l % k
    r1 = r % k
    if r1 < l1:
        seg.append([0, r1])
        seg.append([l1, k - 1])
    else:
        seg.append([l1, r1])
seg.sort()
mxr, res = -1, 0
for x in seg:
    res += max(0, x[1] - max(mxr, x[0] - 1))
    mxr = x[1]
print res
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 4952 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 4940 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -