結果

問題 No.1338 Giant Class
ユーザー shu8Creamshu8Cream
提出日時 2021-01-15 22:57:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 204,996 KB
実行使用メモリ 8,144 KB
最終ジャッジ日時 2023-08-17 18:13:12
合計ジャッジ時間 6,943 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 156 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 134 ms
6,608 KB
testcase_07 AC 199 ms
7,548 KB
testcase_08 AC 124 ms
6,160 KB
testcase_09 AC 117 ms
6,156 KB
testcase_10 AC 221 ms
7,960 KB
testcase_11 AC 19 ms
4,376 KB
testcase_12 AC 150 ms
5,692 KB
testcase_13 AC 123 ms
6,088 KB
testcase_14 AC 31 ms
4,376 KB
testcase_15 AC 46 ms
4,432 KB
testcase_16 AC 16 ms
4,376 KB
testcase_17 AC 119 ms
6,048 KB
testcase_18 AC 31 ms
4,380 KB
testcase_19 AC 56 ms
4,652 KB
testcase_20 AC 226 ms
8,060 KB
testcase_21 AC 223 ms
8,144 KB
testcase_22 AC 230 ms
8,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
*    author:  shu8Cream
*    created: 15.01.2021 21:54:39
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll h,w,q;
    cin >> h >> w >> q;
    ll ans = h*w;
    map<int,int> m;
    while(q--){
        int y,x;
        cin >> y >> x;
        y--; x--;
        ll cnt = h-y;
        if(!m.count(x)) m[x]=y;
        else if(m[x]>y){
            cnt=m[x]-y;
            m[x]=y;
        }else cnt=0;
        ans-=cnt;
        cout << ans << endl;
    }
}
0