結果

問題 No.1338 Giant Class
ユーザー nono00nono00
提出日時 2022-12-23 21:58:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 2,498 ms
コンパイル使用メモリ 204,568 KB
実行使用メモリ 8,188 KB
最終ジャッジ日時 2023-08-11 12:04:50
合計ジャッジ時間 9,699 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 198 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 166 ms
6,332 KB
testcase_07 AC 228 ms
7,484 KB
testcase_08 AC 147 ms
6,024 KB
testcase_09 AC 142 ms
5,828 KB
testcase_10 AC 252 ms
8,112 KB
testcase_11 AC 25 ms
4,380 KB
testcase_12 AC 179 ms
5,672 KB
testcase_13 AC 151 ms
6,000 KB
testcase_14 AC 40 ms
4,384 KB
testcase_15 AC 60 ms
4,440 KB
testcase_16 AC 20 ms
4,380 KB
testcase_17 AC 151 ms
6,100 KB
testcase_18 AC 38 ms
4,380 KB
testcase_19 AC 69 ms
4,628 KB
testcase_20 AC 273 ms
8,188 KB
testcase_21 AC 290 ms
8,024 KB
testcase_22 AC 273 ms
8,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int h, w, q;
    cin >> h >> w >> q;
    map<int, int> mp;
    long long ans = (ll)h * w;

    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> y >> x;
        if (mp[x] == 0) {
            ans -= (h - y + 1);
            mp[x] = y;
        } else if (mp[x] > y) {
            ans -= mp[x] - y;
            mp[x] = y;
        }

        cout << ans << endl;
    }
}

0