結果

問題 No.1338 Giant Class
ユーザー merom686merom686
提出日時 2021-01-15 21:50:00
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 102,352 KB
実行使用メモリ 8,108 KB
最終ジャッジ日時 2023-08-17 16:46:26
合計ジャッジ時間 5,810 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 203 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 173 ms
6,276 KB
testcase_07 AC 256 ms
7,580 KB
testcase_08 AC 157 ms
6,176 KB
testcase_09 AC 146 ms
5,916 KB
testcase_10 AC 277 ms
8,048 KB
testcase_11 AC 22 ms
4,376 KB
testcase_12 AC 174 ms
5,696 KB
testcase_13 AC 148 ms
6,028 KB
testcase_14 AC 38 ms
4,380 KB
testcase_15 AC 58 ms
4,400 KB
testcase_16 AC 19 ms
4,380 KB
testcase_17 AC 145 ms
6,176 KB
testcase_18 AC 36 ms
4,376 KB
testcase_19 AC 66 ms
4,616 KB
testcase_20 AC 278 ms
8,088 KB
testcase_21 AC 260 ms
8,108 KB
testcase_22 AC 259 ms
8,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int h, w, q;
    cin >> h >> w >> q;

    ll r = (ll)h * w;
    map<int, int> mp;

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

        int t, s = 0;
        if (mp.count(x) == 0) {
            s = h;
            t = mp[x] = y;
            s -= t;
        } else {
            s = mp[x];
            t = mp[x] = min(s, y);
            s -= t;
        }

        r -= s;
        cout << r << '\n';
    }

    return 0;
}
0