結果

問題 No.1338 Giant Class
ユーザー first_vil
提出日時 2020-07-08 00:14:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 1,951 ms
コンパイル使用メモリ 199,412 KB
最終ジャッジ日時 2025-01-11 16:44:40
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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