結果

問題 No.1338 Giant Class
ユーザー SSRSSSRS
提出日時 2021-01-15 21:28:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 1,695 ms
コンパイル使用メモリ 173,452 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-05-04 22:43:41
合計ジャッジ時間 5,880 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 178 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 164 ms
6,400 KB
testcase_07 AC 246 ms
7,680 KB
testcase_08 AC 153 ms
6,144 KB
testcase_09 AC 143 ms
6,016 KB
testcase_10 AC 273 ms
7,936 KB
testcase_11 AC 23 ms
5,376 KB
testcase_12 AC 184 ms
5,888 KB
testcase_13 AC 161 ms
6,272 KB
testcase_14 AC 39 ms
5,376 KB
testcase_15 AC 63 ms
5,376 KB
testcase_16 AC 20 ms
5,376 KB
testcase_17 AC 170 ms
6,272 KB
testcase_18 AC 45 ms
5,376 KB
testcase_19 AC 81 ms
5,376 KB
testcase_20 AC 308 ms
8,192 KB
testcase_21 AC 282 ms
8,192 KB
testcase_22 AC 281 ms
8,192 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