結果

問題 No.1338 Giant Class
ユーザー MisterMister
提出日時 2021-01-15 21:25:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 588 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 9,748 KB
最終ジャッジ日時 2023-08-17 16:00:21
合計ジャッジ時間 4,644 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 34 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 85 ms
7,228 KB
testcase_07 AC 128 ms
9,040 KB
testcase_08 AC 75 ms
7,180 KB
testcase_09 AC 70 ms
6,716 KB
testcase_10 AC 136 ms
9,472 KB
testcase_11 AC 11 ms
4,380 KB
testcase_12 AC 84 ms
6,424 KB
testcase_13 AC 76 ms
6,908 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 26 ms
4,760 KB
testcase_16 AC 9 ms
4,376 KB
testcase_17 AC 75 ms
6,972 KB
testcase_18 AC 17 ms
4,376 KB
testcase_19 AC 32 ms
5,088 KB
testcase_20 AC 145 ms
9,572 KB
testcase_21 AC 143 ms
9,748 KB
testcase_22 AC 143 ms
9,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "main.cpp"
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;
using lint = long long;

void solve() {
    lint h, w;
    int q;
    cin >> h >> w >> q;

    lint ans = h * w;
    map<lint, lint> pos;

    while (q--) {
        lint x, y;
        cin >> x >> y;

        if (!pos.count(y)) pos[y] = h + 1;
        if (pos[y] >= x) {
            ans -= pos[y] - x;
            pos[y] = x;
        }

        cout << ans << "\n";
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
0