結果

問題 No.1338 Giant Class
ユーザー KKT89KKT89
提出日時 2021-02-25 05:47:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 2,155 ms
コンパイル使用メモリ 209,684 KB
実行使用メモリ 8,408 KB
最終ジャッジ日時 2023-10-25 10:25:57
合計ジャッジ時間 7,231 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 39 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 56 ms
6,656 KB
testcase_07 AC 82 ms
7,892 KB
testcase_08 AC 52 ms
6,436 KB
testcase_09 AC 52 ms
6,232 KB
testcase_10 AC 104 ms
8,292 KB
testcase_11 AC 9 ms
4,348 KB
testcase_12 AC 66 ms
6,032 KB
testcase_13 AC 57 ms
6,392 KB
testcase_14 AC 15 ms
4,436 KB
testcase_15 AC 22 ms
4,784 KB
testcase_16 AC 8 ms
4,348 KB
testcase_17 AC 57 ms
6,400 KB
testcase_18 AC 14 ms
4,420 KB
testcase_19 AC 25 ms
4,984 KB
testcase_20 AC 107 ms
8,408 KB
testcase_21 AC 108 ms
8,408 KB
testcase_22 AC 108 ms
8,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll h,w,q; cin >> h >> w >> q;
    ll res=h*w;
    map<int,int> mp;
    while(q--){
        int y,x; cin >> y >> x;
        if(mp.find(x)==mp.end()){
            res-=h;
            mp[x]=y;
            res+=mp[x]-1;
        }
        else{
            if(mp[x]>y){
                res-=mp[x]-1;
                mp[x]=y;
                res+=mp[x]-1;
            }
        }
        printf("%lld\n",res);
    }
}
0