結果

問題 No.1338 Giant Class
ユーザー Fu_LFu_L
提出日時 2021-05-13 23:18:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 4,389 ms
コンパイル使用メモリ 268,620 KB
実行使用メモリ 9,836 KB
最終ジャッジ日時 2023-10-26 03:15:09
合計ジャッジ時間 9,325 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 155 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 137 ms
7,496 KB
testcase_07 AC 204 ms
9,148 KB
testcase_08 AC 128 ms
7,204 KB
testcase_09 AC 117 ms
6,932 KB
testcase_10 AC 232 ms
9,680 KB
testcase_11 AC 19 ms
4,348 KB
testcase_12 AC 153 ms
6,668 KB
testcase_13 AC 126 ms
7,148 KB
testcase_14 AC 31 ms
4,536 KB
testcase_15 AC 47 ms
5,000 KB
testcase_16 AC 16 ms
4,348 KB
testcase_17 AC 126 ms
7,160 KB
testcase_18 AC 31 ms
4,516 KB
testcase_19 AC 57 ms
5,268 KB
testcase_20 AC 238 ms
9,836 KB
testcase_21 AC 239 ms
9,836 KB
testcase_22 AC 234 ms
9,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef modint1000000007 mint;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
const ll inf=1e18;
ll h,w,q;
ll ans;
P p;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>h>>w>>q;
    ans=h*w;
    map<ll,ll> m;
    while(q--){
        cin>>p.first>>p.second;
        auto itr=m.find(p.second);
        if(itr==m.end()){
            ans-=(h-p.first+1);
            m[p.second]=p.first;
        }else{
            if(m[p.second]>p.first){
                ans-=(m[p.second]-p.first);
                m[p.second]=p.first;
            }
        }
        cout<<ans<<endl;
    }
}
0