結果

問題 No.1338 Giant Class
ユーザー deuteridayo
提出日時 2021-01-17 13:59:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 264 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 1,719 ms
コンパイル使用メモリ 172,336 KB
実行使用メモリ 9,380 KB
最終ジャッジ日時 2024-11-29 15:10:08
合計ジャッジ時間 6,268 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
// #include<atcoder/all>
using namespace std;
// using namespace atcoder;
using lint = long long;
#define endl '\n'
lint const mod = 1e9+7;
//long const mod = 998244353;

    lint h,w,q;

    lint y[100000];
    lint x[100000];
unordered_map<lint,lint>mapp;

int main(){
    cin >> h >> w >> q;
    lint ans = h*w;
    for(int i=0;i<q;i++){
        cin >> y[i] >> x[i];
        if(mapp[x[i]] == 0){
            mapp[x[i]] = y[i];
            ans -= (h - y[i] + 1);
        }else{
            if(mapp[x[i]] > y[i]){
                ans -= mapp[x[i]] - y[i];
                mapp[x[i]] = y[i];
            }
        }
        
        
        cout << ans << endl;
    }
}
0