結果

問題 No.1338 Giant Class
ユーザー ninoinuininoinui
提出日時 2021-01-16 09:26:26
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 2,254 ms
コンパイル使用メモリ 204,180 KB
実行使用メモリ 9,684 KB
最終ジャッジ日時 2023-08-18 05:55:25
合計ジャッジ時間 5,467 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 31 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 55 ms
7,264 KB
testcase_07 AC 84 ms
9,000 KB
testcase_08 AC 50 ms
7,260 KB
testcase_09 AC 46 ms
7,028 KB
testcase_10 AC 95 ms
9,472 KB
testcase_11 AC 8 ms
4,380 KB
testcase_12 AC 60 ms
6,548 KB
testcase_13 AC 53 ms
6,924 KB
testcase_14 AC 12 ms
4,388 KB
testcase_15 AC 18 ms
4,916 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 48 ms
6,976 KB
testcase_18 AC 12 ms
4,388 KB
testcase_19 AC 22 ms
5,076 KB
testcase_20 AC 95 ms
9,668 KB
testcase_21 AC 101 ms
9,664 KB
testcase_22 AC 100 ms
9,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

template <class A, class B> bool cmin(A& a, B b) { return a > b && (a = b, true); }
template <class A, class B> bool cmax(A& a, B b) { return a < b && (a = b, true); }

signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);

  long H, W, Q;
  cin >> H >> W >> Q;
  long ans = H * W;
  map<long, long> MA;
  for (long i = 0; i < Q; i++) {
    long y, x;
    cin >> y >> x;
    if (MA.count(x)) {
      if (y >= MA[x]) {
        cout << ans << '\n';
      } else {
        ans += H - MA[x] + 1;
        ans -= H - y + 1;
        MA[x] = y;
        cout << ans << '\n';
      }
    } else {
      ans -= H - y + 1;
      MA[x] = y;
      cout << ans << '\n';
    }
  }
}
0