結果

問題 No.1338 Giant Class
ユーザー nephrologist
提出日時 2021-01-15 23:24:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 87,720 KB
最終ジャッジ日時 2024-11-26 18:31:12
合計ジャッジ時間 4,921 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline
h, w, q = map(int, input().split())

memo = {}
temp = 0
for _ in range(q):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    if x in memo:
        pre = memo[x]
        if pre < y:
            print(h * w - temp)
        else:
            memo[x] = y
            temp += pre - y
            print(h * w - temp)
    else:
        memo[x] = y
        temp += h - y
        print(h * w - temp)
0