結果

問題 No.1338 Giant Class
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-15 23:48:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 89,192 KB
最終ジャッジ日時 2023-08-17 19:14:00
合計ジャッジ時間 5,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,616 KB
testcase_01 AC 94 ms
71,632 KB
testcase_02 AC 144 ms
77,900 KB
testcase_03 AC 96 ms
71,408 KB
testcase_04 AC 96 ms
71,740 KB
testcase_05 AC 93 ms
71,496 KB
testcase_06 AC 148 ms
84,024 KB
testcase_07 AC 168 ms
87,964 KB
testcase_08 AC 151 ms
84,276 KB
testcase_09 AC 151 ms
83,460 KB
testcase_10 AC 177 ms
89,192 KB
testcase_11 AC 112 ms
77,836 KB
testcase_12 AC 163 ms
83,952 KB
testcase_13 AC 145 ms
83,220 KB
testcase_14 AC 120 ms
78,616 KB
testcase_15 AC 124 ms
79,944 KB
testcase_16 AC 114 ms
77,612 KB
testcase_17 AC 144 ms
84,396 KB
testcase_18 AC 117 ms
78,572 KB
testcase_19 AC 126 ms
80,388 KB
testcase_20 AC 175 ms
88,896 KB
testcase_21 AC 175 ms
88,800 KB
testcase_22 AC 170 ms
88,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

H, W, Q = map(int, input().split())
row = defaultdict(int)
ans = H * W
for _ in range(Q):
    h, w = map(int, input().split())
    if not row[w]:
        ans -= H - h + 1
        row[w] = h
    else:
        if row[w] > h:
            ans -= row[w] - h
            row[w] = h
    print(ans)
0