結果

問題 No.1338 Giant Class
ユーザー kaede2020kaede2020
提出日時 2021-01-15 22:29:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 1,714 ms
コンパイル使用メモリ 172,196 KB
実行使用メモリ 9,708 KB
最終ジャッジ日時 2023-08-17 17:48:09
合計ジャッジ時間 6,205 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 172 ms
4,376 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 150 ms
7,328 KB
testcase_07 AC 220 ms
8,984 KB
testcase_08 AC 141 ms
7,016 KB
testcase_09 AC 133 ms
6,764 KB
testcase_10 AC 259 ms
9,508 KB
testcase_11 AC 21 ms
4,380 KB
testcase_12 AC 173 ms
6,484 KB
testcase_13 AC 142 ms
6,956 KB
testcase_14 AC 35 ms
4,392 KB
testcase_15 AC 53 ms
4,804 KB
testcase_16 AC 18 ms
4,384 KB
testcase_17 AC 136 ms
6,952 KB
testcase_18 AC 34 ms
4,388 KB
testcase_19 AC 61 ms
5,028 KB
testcase_20 AC 250 ms
9,608 KB
testcase_21 AC 255 ms
9,708 KB
testcase_22 AC 255 ms
9,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll h,w,q;
    cin>>h>>w>>q;
    map<ll,ll>a;
    ll ans=h*w;
    rep(i,q){
        ll y,x;
        cin>>y>>x;
        ll tmp=0;
        if(a.count(x))tmp=a[x];
        else tmp=h+1;
        a[x]=min(tmp,y);
        //cout<<a[x]<<" "<<tmp<<endl;
        ans-=max(0LL,tmp-a[x]);
        cout<<ans<<endl;
    }
    return 0;
}
0