import sys
input_data = sys.stdin.read().split()
n = int(input_data.pop(0))
heights = [0] * 5000006
for _ in range(n):
x = int(input_data.pop(0))
y = int(input_data.pop(0))
heights[x // 2] = max(heights[x // 2], y)
res = 0
for i in range(5000000, 0, -1):
heights[i] = max(heights[i], heights[i + 1])
res += heights[i]
print(res << 1)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
59528 KB |
Output is correct |
2 |
Correct |
42 ms |
59328 KB |
Output is correct |
3 |
Correct |
42 ms |
59264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
59196 KB |
Output is correct |
2 |
Correct |
43 ms |
59188 KB |
Output is correct |
3 |
Correct |
43 ms |
59188 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
59204 KB |
Output is correct |
2 |
Correct |
46 ms |
59312 KB |
Output is correct |
3 |
Correct |
49 ms |
59184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
60464 KB |
Output is correct |
2 |
Correct |
57 ms |
60288 KB |
Output is correct |
3 |
Correct |
57 ms |
60460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
73 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
59188 KB |
Output is correct |
2 |
Correct |
44 ms |
59184 KB |
Output is correct |
3 |
Correct |
50 ms |
59256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
307 ms |
63556 KB |
Output is correct |
2 |
Correct |
312 ms |
63532 KB |
Output is correct |
3 |
Correct |
304 ms |
63272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
51 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
89 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
71 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |