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