結果

問題 No.1338 Giant Class
ユーザー r_ishidar_ishida
提出日時 2021-01-16 09:25:08
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 21,668 KB
最終ジャッジ日時 2023-08-18 05:53:47
合計ジャッジ時間 5,281 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,384 KB
testcase_01 AC 17 ms
8,300 KB
testcase_02 AC 212 ms
8,456 KB
testcase_03 AC 17 ms
8,292 KB
testcase_04 AC 18 ms
8,292 KB
testcase_05 AC 18 ms
8,216 KB
testcase_06 AC 174 ms
14,724 KB
testcase_07 AC 243 ms
21,668 KB
testcase_08 AC 162 ms
15,004 KB
testcase_09 AC 151 ms
14,972 KB
testcase_10 AC 267 ms
21,544 KB
testcase_11 AC 39 ms
9,088 KB
testcase_12 AC 201 ms
14,772 KB
testcase_13 AC 159 ms
15,020 KB
testcase_14 AC 55 ms
9,912 KB
testcase_15 AC 73 ms
11,516 KB
testcase_16 AC 36 ms
9,056 KB
testcase_17 AC 158 ms
14,876 KB
testcase_18 AC 54 ms
9,880 KB
testcase_19 AC 85 ms
11,624 KB
testcase_20 AC 273 ms
21,536 KB
testcase_21 AC 271 ms
21,580 KB
testcase_22 AC 266 ms
21,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import itertools
import math
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

h,w,q = MI()
d = {}

ans = h*w
for i in range(q):
    y,x = MI()
    if x-1 in d:
        if d[x-1] > y-1:
            ans -= d[x-1] - y + 1
            d[x-1] = y - 1
    else:
        d[x-1] = y-1
        ans -= h-d[x-1]
    print(ans)
0