結果
| 問題 | 
                            No.1338 Giant Class
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-01-15 21:25:24 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 122 ms / 2,000 ms | 
| コード長 | 588 bytes | 
| コンパイル時間 | 985 ms | 
| コンパイル使用メモリ | 83,060 KB | 
| 最終ジャッジ日時 | 2025-01-17 18:32:30 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
#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;
}