結果

問題 No.1338 Giant Class
ユーザー bonKotsubonKotsu
提出日時 2021-05-29 12:41:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 265 ms / 2,000 ms
コード長 606 bytes
コンパイル時間 1,475 ms
コンパイル使用メモリ 168,604 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2024-04-25 10:31:48
合計ジャッジ時間 6,655 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 192 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 159 ms
7,424 KB
testcase_07 AC 222 ms
9,344 KB
testcase_08 AC 157 ms
7,168 KB
testcase_09 AC 141 ms
6,784 KB
testcase_10 AC 243 ms
9,600 KB
testcase_11 AC 22 ms
5,376 KB
testcase_12 AC 176 ms
6,784 KB
testcase_13 AC 154 ms
7,040 KB
testcase_14 AC 38 ms
5,376 KB
testcase_15 AC 61 ms
5,376 KB
testcase_16 AC 20 ms
5,376 KB
testcase_17 AC 157 ms
7,168 KB
testcase_18 AC 38 ms
5,376 KB
testcase_19 AC 70 ms
5,376 KB
testcase_20 AC 261 ms
9,728 KB
testcase_21 AC 261 ms
9,728 KB
testcase_22 AC 265 ms
9,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>

int main() {
  ll h, w;
  int q;
  cin >> h >> w >> q;
  map<ll, ll> mp;
  ll sum = h*w;
  rep(qi,q) {
    ll x, y;
    cin >> x >> y;
    if (mp[y] == 0) {
      // y列目にまだ誰も座っていないとき
      mp[y] = x;
      sum -= h-x+1;
    } else {
      // y列目にすでに座っているとき
      if (mp[y] > x) {
        // より前方に座るとき
        sum -= mp[y]-x;
        mp[y] = x;
      }
    }
    cout << sum << endl;
  }


}
0