提出 #69871235
ソースコード 拡げる
from heapq import heappop, heappush
n, q = map(int, input().split())
heap = []
for ver in range(n):
heappush(heap, (ver, 1))
for _ in range(q):
x, y = map(int, input().split())
x -= 1
y -= 1
applied = 0
while heap[0][0] <= x:
applied += heap[0][1]
heappop(heap)
heappush(heap, (y, applied))
print(applied)
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Upgrade Required |
| ユーザ | Favo02 |
| 言語 | Python (PyPy 3.10-v7.3.12) |
| 得点 | 300 |
| コード長 | 377 Byte |
| 結果 | AC |
| 実行時間 | 940 ms |
| メモリ | 151788 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt |
| All | hand_01.txt, hand_02.txt, hand_03.txt, sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| hand_01.txt | AC | 574 ms | 151516 KiB |
| hand_02.txt | AC | 659 ms | 151416 KiB |
| hand_03.txt | AC | 651 ms | 151624 KiB |
| sample_01.txt | AC | 57 ms | 76516 KiB |
| test_01.txt | AC | 57 ms | 76736 KiB |
| test_02.txt | AC | 831 ms | 151488 KiB |
| test_03.txt | AC | 829 ms | 151480 KiB |
| test_04.txt | AC | 847 ms | 151412 KiB |
| test_05.txt | AC | 555 ms | 151524 KiB |
| test_06.txt | AC | 795 ms | 151784 KiB |
| test_07.txt | AC | 621 ms | 151732 KiB |
| test_08.txt | AC | 843 ms | 151360 KiB |
| test_09.txt | AC | 901 ms | 151480 KiB |
| test_10.txt | AC | 520 ms | 93816 KiB |
| test_11.txt | AC | 519 ms | 93020 KiB |
| test_12.txt | AC | 406 ms | 97984 KiB |
| test_13.txt | AC | 408 ms | 98452 KiB |
| test_14.txt | AC | 881 ms | 151788 KiB |
| test_15.txt | AC | 644 ms | 151612 KiB |
| test_16.txt | AC | 856 ms | 151452 KiB |
| test_17.txt | AC | 871 ms | 151600 KiB |
| test_18.txt | AC | 634 ms | 151352 KiB |
| test_19.txt | AC | 878 ms | 151616 KiB |
| test_20.txt | AC | 925 ms | 151476 KiB |
| test_21.txt | AC | 940 ms | 151340 KiB |
| test_22.txt | AC | 928 ms | 151632 KiB |