結果
| 問題 | 
                            No.1338 Giant Class
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-01-15 22:29:20 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 230 ms / 2,000 ms | 
| コード長 | 503 bytes | 
| コンパイル時間 | 1,527 ms | 
| コンパイル使用メモリ | 174,212 KB | 
| 実行使用メモリ | 9,728 KB | 
| 最終ジャッジ日時 | 2024-11-26 16:17:50 | 
| 合計ジャッジ時間 | 5,476 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll h,w,q;
    cin>>h>>w>>q;
    map<ll,ll>a;
    ll ans=h*w;
    rep(i,q){
        ll y,x;
        cin>>y>>x;
        ll tmp=0;
        if(a.count(x))tmp=a[x];
        else tmp=h+1;
        a[x]=min(tmp,y);
        //cout<<a[x]<<" "<<tmp<<endl;
        ans-=max(0LL,tmp-a[x]);
        cout<<ans<<endl;
    }
    return 0;
}