結果
| 問題 | 
                            No.1338 Giant Class
                             | 
                    
| コンテスト | |
| ユーザー | 
                            👑  | 
                    
| 提出日時 | 2022-01-01 21:24:12 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 311 ms / 2,000 ms | 
| コード長 | 379 bytes | 
| コンパイル時間 | 999 ms | 
| コンパイル使用メモリ | 75,904 KB | 
| 実行使用メモリ | 9,856 KB | 
| 最終ジャッジ日時 | 2024-10-10 14:59:03 | 
| 合計ジャッジ時間 | 6,393 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
#include <iostream>
#include <map>
using namespace std;
int main(){
  long long h,w,q;cin>>h>>w>>q;
  map<long long,long long> A;
  long long ans = h*w;
  for(int i = 0; q > i; i++){
    long long x,y;cin>>y>>x;
    if(!A.count(x)){
      ans -= h-(y-1);
      A[x] = y-1;
    }else if(A[x] > y-1){
      ans -= A[x]-(y-1);
      A[x] = y-1;
    }
    cout << ans << endl;
  }
}