답안 #222715

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222715 2020-04-13T21:36:47 Z shart23 이상한 기계 (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
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 4952 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 4940 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 4960 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -