結果
| 問題 | 
                            No.1338 Giant Class
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-01-15 22:46:30 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 256 ms / 2,000 ms | 
| コード長 | 344 bytes | 
| コンパイル時間 | 1,506 ms | 
| コンパイル使用メモリ | 173,312 KB | 
| 実行使用メモリ | 8,320 KB | 
| 最終ジャッジ日時 | 2024-11-26 16:49:30 | 
| 合計ジャッジ時間 | 5,564 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
#include<bits/stdc++.h> 
using namespace std;
const int64_t mod=1e9+7;
int main(){
  int64_t h,w,q;
  cin>>h>>w>>q;
  int64_t ans=h*w;
  map<int,int>isu;
  int x,y;
  while(q--){
    cin>>y>>x;
    if(!isu.count(x)){
      ans-=h+1-y;
      isu[x]=y;
    }else if(isu[x]>y){
      ans-=isu[x]-y;
      isu[x]=y;
    }
    cout<<ans<<'\n';
  }
}