結果

問題 No.1338 Giant Class
ユーザー first_vilfirst_vil
提出日時 2020-07-08 00:14:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 2,276 ms
コンパイル使用メモリ 201,048 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-04-19 02:51:59
合計ジャッジ時間 5,167 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 35 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 62 ms
6,400 KB
testcase_07 AC 87 ms
7,808 KB
testcase_08 AC 64 ms
6,144 KB
testcase_09 AC 57 ms
6,016 KB
testcase_10 AC 105 ms
8,064 KB
testcase_11 AC 9 ms
5,376 KB
testcase_12 AC 60 ms
5,632 KB
testcase_13 AC 59 ms
6,144 KB
testcase_14 AC 16 ms
5,376 KB
testcase_15 AC 23 ms
5,376 KB
testcase_16 AC 9 ms
5,376 KB
testcase_17 AC 61 ms
6,272 KB
testcase_18 AC 16 ms
5,376 KB
testcase_19 AC 26 ms
5,376 KB
testcase_20 AC 110 ms
8,320 KB
testcase_21 AC 111 ms
8,192 KB
testcase_22 AC 108 ms
8,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }

int main() {
    init();

    int h, w, q; cin >> h >> w >> q;
    ll ans = ll(h) * ll(w);
    map<int, int> m;
    while (q--) {
        int y, x; cin >> y >> x;
        if (!m.count(x))m[x] = h + 1;
        ans -= max(0, m[x] - y);
        chmin(m[x], y);
        print(ans);
    }

    return 0;
}
0