結果

問題 No.1338 Giant Class
ユーザー zumin
提出日時 2021-02-22 22:24:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 76,032 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-09-21 17:55:02
合計ジャッジ時間 6,182 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>

using namespace std;
using ll=long long;

int main(){
    ll h,w,q;
    cin>>h>>w>>q;
    ll ret=h*w;
    map<ll,ll> seatingch;

    for(int i=0;i<q;i++){
        ll y,x;
        cin>>y>>x;
        if(seatingch.count(x)){
            if(seatingch[x]>y){
                ret+=h-seatingch[x]+1;
                seatingch[x]=y;
                ret-=h-y+1;
            }
        }else{
            seatingch[x]=y;
            ret-=h-y+1;
        }
        cout<<ret<<endl;
    }

    return 0;
}
0