n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
x, y = map(int, input().split())
a[i] = x
b[i] = y
# subtask 1 only
ans = 0
extra = 0
for i in range(n):
ans += abs(extra)
extra += a[i] - b[i]
print(ans)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
2908 KB |
Output is correct |
2 |
Correct |
14 ms |
3032 KB |
Output is correct |
3 |
Correct |
15 ms |
3164 KB |
Output is correct |
4 |
Correct |
86 ms |
5324 KB |
Output is correct |
5 |
Correct |
164 ms |
7764 KB |
Output is correct |
6 |
Correct |
406 ms |
25940 KB |
Output is correct |
7 |
Correct |
817 ms |
49324 KB |
Output is correct |
8 |
Correct |
776 ms |
31316 KB |
Output is correct |
9 |
Correct |
784 ms |
30680 KB |
Output is correct |
10 |
Correct |
753 ms |
12664 KB |
Output is correct |
11 |
Correct |
746 ms |
12668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
2908 KB |
Output is correct |
2 |
Correct |
14 ms |
3032 KB |
Output is correct |
3 |
Correct |
15 ms |
3164 KB |
Output is correct |
4 |
Correct |
86 ms |
5324 KB |
Output is correct |
5 |
Correct |
164 ms |
7764 KB |
Output is correct |
6 |
Correct |
406 ms |
25940 KB |
Output is correct |
7 |
Correct |
817 ms |
49324 KB |
Output is correct |
8 |
Correct |
776 ms |
31316 KB |
Output is correct |
9 |
Correct |
784 ms |
30680 KB |
Output is correct |
10 |
Correct |
753 ms |
12664 KB |
Output is correct |
11 |
Correct |
746 ms |
12668 KB |
Output is correct |
12 |
Incorrect |
221 ms |
14472 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
2908 KB |
Output is correct |
2 |
Correct |
14 ms |
3032 KB |
Output is correct |
3 |
Incorrect |
10 ms |
2904 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
2908 KB |
Output is correct |
2 |
Correct |
14 ms |
3032 KB |
Output is correct |
3 |
Correct |
15 ms |
3164 KB |
Output is correct |
4 |
Incorrect |
10 ms |
2904 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
2908 KB |
Output is correct |
2 |
Correct |
14 ms |
3032 KB |
Output is correct |
3 |
Correct |
15 ms |
3164 KB |
Output is correct |
4 |
Incorrect |
10 ms |
2904 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |