結果

問題 No.1338 Giant Class
ユーザー merom686merom686
提出日時 2021-01-16 01:25:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 878 ms
コンパイル使用メモリ 100,960 KB
実行使用メモリ 8,132 KB
最終ジャッジ日時 2023-08-17 20:14:03
合計ジャッジ時間 5,625 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 198 ms
4,380 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 160 ms
6,260 KB
testcase_07 AC 237 ms
7,696 KB
testcase_08 AC 150 ms
6,048 KB
testcase_09 AC 139 ms
5,864 KB
testcase_10 AC 260 ms
8,132 KB
testcase_11 AC 23 ms
4,380 KB
testcase_12 AC 175 ms
5,648 KB
testcase_13 AC 158 ms
6,228 KB
testcase_14 AC 38 ms
4,376 KB
testcase_15 AC 56 ms
4,480 KB
testcase_16 AC 20 ms
4,376 KB
testcase_17 AC 153 ms
6,072 KB
testcase_18 AC 38 ms
4,376 KB
testcase_19 AC 69 ms
4,672 KB
testcase_20 AC 284 ms
8,124 KB
testcase_21 AC 282 ms
8,128 KB
testcase_22 AC 279 ms
8,108 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--;

        auto it = mp.insert({ x, y });
        if (it.second) {
            r -= h - y;
        } else if (int &t = it.first->second; y < t) {
            r -= t - y;
            t = y;
        }

        cout << r << '\n';
    }

    return 0;
}
0