結果

問題 No.1338 Giant Class
ユーザー zuminzumin
提出日時 2021-02-22 22:24:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 76,096 KB
実行使用メモリ 9,876 KB
最終ジャッジ日時 2023-10-21 16:39:03
合計ジャッジ時間 7,922 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 197 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 170 ms
7,536 KB
testcase_07 AC 253 ms
9,188 KB
testcase_08 AC 161 ms
7,244 KB
testcase_09 AC 148 ms
6,972 KB
testcase_10 AC 287 ms
9,720 KB
testcase_11 AC 25 ms
4,348 KB
testcase_12 AC 191 ms
6,708 KB
testcase_13 AC 165 ms
7,188 KB
testcase_14 AC 41 ms
4,576 KB
testcase_15 AC 62 ms
5,040 KB
testcase_16 AC 22 ms
4,348 KB
testcase_17 AC 165 ms
7,200 KB
testcase_18 AC 41 ms
4,556 KB
testcase_19 AC 74 ms
5,308 KB
testcase_20 AC 305 ms
9,876 KB
testcase_21 AC 299 ms
9,876 KB
testcase_22 AC 299 ms
9,876 KB
権限があれば一括ダウンロードができます

ソースコード

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