結果

問題 No.1338 Giant Class
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-08-25 00:01:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 2,515 ms
コンパイル使用メモリ 204,364 KB
実行使用メモリ 9,700 KB
最終ジャッジ日時 2023-08-25 00:01:42
合計ジャッジ時間 9,362 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 213 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 161 ms
7,240 KB
testcase_07 AC 239 ms
9,032 KB
testcase_08 AC 151 ms
6,968 KB
testcase_09 AC 142 ms
6,696 KB
testcase_10 AC 295 ms
9,484 KB
testcase_11 AC 24 ms
4,380 KB
testcase_12 AC 182 ms
6,468 KB
testcase_13 AC 158 ms
6,948 KB
testcase_14 AC 40 ms
4,384 KB
testcase_15 AC 61 ms
4,748 KB
testcase_16 AC 21 ms
4,380 KB
testcase_17 AC 155 ms
6,932 KB
testcase_18 AC 40 ms
4,380 KB
testcase_19 AC 72 ms
5,200 KB
testcase_20 AC 284 ms
9,700 KB
testcase_21 AC 286 ms
9,588 KB
testcase_22 AC 280 ms
9,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){

    ll H, W, Q, ans, x, y, mi;
    cin >> H >> W >> Q;
    map<ll, ll> mp;
    ans = H*W;

    while(Q){
        Q--;
        cin >> x >> y;
        swap(x, y);
        mi = H+1;
        if (mp.count(x)){
            mi = mp[x];
            mp[x] = min(mi, y);
        }
        else mp[x] = y;
        ans -= max(mi-y, 0LL);
        cout << ans << endl;
    }

    return 0;
}
0