結果

問題 No.1338 Giant Class
ユーザー SSRSSSRS
提出日時 2021-01-15 21:28:32
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 314 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 1,598 ms
コンパイル使用メモリ 171,608 KB
実行使用メモリ 8,172 KB
最終ジャッジ日時 2023-08-17 16:05:30
合計ジャッジ時間 6,713 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 187 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 179 ms
6,432 KB
testcase_07 AC 261 ms
7,536 KB
testcase_08 AC 166 ms
6,276 KB
testcase_09 AC 151 ms
6,012 KB
testcase_10 AC 286 ms
7,988 KB
testcase_11 AC 26 ms
4,380 KB
testcase_12 AC 189 ms
5,752 KB
testcase_13 AC 165 ms
6,028 KB
testcase_14 AC 43 ms
4,376 KB
testcase_15 AC 63 ms
4,420 KB
testcase_16 AC 22 ms
4,376 KB
testcase_17 AC 165 ms
6,252 KB
testcase_18 AC 41 ms
4,376 KB
testcase_19 AC 77 ms
4,680 KB
testcase_20 AC 307 ms
8,124 KB
testcase_21 AC 314 ms
8,036 KB
testcase_22 AC 305 ms
8,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, W, Q;
  cin >> H >> W >> Q;
  map<int, int> mp;
  long long ans = (long long) H * W;
  for (int i = 0; i < Q; i++){
    int Y, X;
    cin >> Y >> X;
    X--;
    Y--;
    if (!mp.count(X)){
      mp[X] = H;
    }
    if (mp[X] > Y){
      ans -= mp[X] - Y;
      mp[X] = Y;
    }
    cout << ans << endl;
  }
}
0