結果

問題 No.1338 Giant Class
ユーザー yuuiyuui
提出日時 2021-01-15 22:02:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 206,080 KB
実行使用メモリ 7,952 KB
最終ジャッジ日時 2023-08-17 17:08:50
合計ジャッジ時間 4,711 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 29 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 32 ms
5,748 KB
testcase_07 AC 50 ms
7,900 KB
testcase_08 AC 30 ms
5,544 KB
testcase_09 AC 27 ms
5,540 KB
testcase_10 AC 55 ms
7,820 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 33 ms
5,728 KB
testcase_13 AC 32 ms
5,612 KB
testcase_14 AC 9 ms
4,376 KB
testcase_15 AC 13 ms
4,376 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 32 ms
5,496 KB
testcase_18 AC 9 ms
4,376 KB
testcase_19 AC 15 ms
4,424 KB
testcase_20 AC 58 ms
7,836 KB
testcase_21 AC 60 ms
7,828 KB
testcase_22 AC 57 ms
7,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll H, W, Q;
    cin >> H >> W >> Q;
    unordered_map<ll, ll> mp;
    ll ans = H * W;
    rep(q, Q) {
        int y, x;
        cin >> y >> x;
        --y;
        --x;
        if (mp.find(x) == mp.end()) {
            ans -= (H - y);
            mp[x] = y;
        } else if (mp[x] > y) {
            ans -= (mp[x] - y);
            mp[x] = y;
        }
        cout << ans << "\n";
    }

    return 0;
}
0