結果
| 問題 | 
                            No.1338 Giant Class
                             | 
                    
| コンテスト | |
| ユーザー | 
                             🍮かんプリン
                         | 
                    
| 提出日時 | 2021-01-15 23:21:16 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 305 ms / 2,000 ms | 
| コード長 | 576 bytes | 
| コンパイル時間 | 1,789 ms | 
| コンパイル使用メモリ | 173,320 KB | 
| 実行使用メモリ | 9,728 KB | 
| 最終ジャッジ日時 | 2024-11-26 17:41:06 | 
| 合計ジャッジ時間 | 6,569 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2021.01.15 23:21:12
**/
#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;
int main() {
    ll h,w,q;cin >> h >> w >> q;
    map<ll,ll> mp;
    ll ans = h * w;
    for (int i = 0; i < q; i++) {
        ll y,x;cin >> y >> x;
        if (mp.find(x) != mp.end()) {
            ans += h-mp[x]+1;
            mp[x] = min(mp[x],y);
            ans -= h-mp[x]+1;
        }
        else {
            mp[x] = y;
            ans -= h - y + 1;
        }
        cout << ans << endl;
    }
    return 0;
}
            
            
            
        
            
🍮かんプリン