結果

問題 No.1338 Giant Class
ユーザー hitonanode
提出日時 2021-01-15 23:42:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 2,378 ms
コンパイル使用メモリ 198,540 KB
最終ジャッジ日時 2025-01-17 20:48:39
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;

int main() {
    cin.tie(nullptr), ios::sync_with_stdio(false);
    lint H, W;
    cin >> H >> W;
    lint ret = H * W;
    int Q;
    cin >> Q;
    unordered_map<int, int> mp;
    while (Q--) {
        int y, x;
        cin >> y >> x;
        if (!mp.count(x)) mp[x] = H + 1;
        if (y < mp[x]) {
            lint d = mp[x] - y;
            mp[x] = y;
            ret -= d;
        }
        cout << ret << '\n';
    }
}
0