結果

問題 No.1338 Giant Class
ユーザー ぷらぷら
提出日時 2021-01-15 21:31:28
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 1,566 ms
コンパイル使用メモリ 173,968 KB
実行使用メモリ 11,084 KB
最終ジャッジ日時 2023-08-17 16:09:50
合計ジャッジ時間 6,264 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 190 ms
4,716 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 171 ms
8,104 KB
testcase_07 AC 242 ms
9,852 KB
testcase_08 AC 155 ms
7,472 KB
testcase_09 AC 143 ms
7,320 KB
testcase_10 AC 271 ms
10,640 KB
testcase_11 AC 22 ms
4,380 KB
testcase_12 AC 181 ms
7,392 KB
testcase_13 AC 160 ms
7,628 KB
testcase_14 AC 41 ms
4,828 KB
testcase_15 AC 60 ms
4,912 KB
testcase_16 AC 21 ms
4,376 KB
testcase_17 AC 160 ms
7,632 KB
testcase_18 AC 40 ms
4,516 KB
testcase_19 AC 72 ms
5,096 KB
testcase_20 AC 289 ms
11,068 KB
testcase_21 AC 285 ms
11,084 KB
testcase_22 AC 291 ms
10,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 3e18+7;
int mod = 1e9+7;
int dx[] = {1, 0,-1, 0, 1, 1,-1,-1};
int dy[] = {0, 1, 0,-1, 1,-1, 1,-1};
signed main() {
    int H,W,Q;
    cin >> H >> W >> Q;
    vector<int>Y(Q),X(Q);
    int ans = H*W;
    map<int,int>Mp;
    for(int i = 0; i < Q; i++) {
        cin >> Y[i] >> X[i];
        if(!Mp.count(X[i])) {
            Mp[X[i]] = Y[i];
            ans -= H-Y[i]+1;
        }
        else if(Mp[X[i]] > Y[i]) {
            ans -= Mp[X[i]]-Y[i];
            Mp[X[i]] = Y[i];
        }
        cout << ans << endl;
    }
}
0