結果

問題 No.1338 Giant Class
ユーザー batsumarubatsumaru
提出日時 2021-01-15 21:57:18
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 1,596 ms
コンパイル使用メモリ 172,320 KB
実行使用メモリ 9,796 KB
最終ジャッジ日時 2023-08-17 17:00:14
合計ジャッジ時間 7,060 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 208 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 178 ms
7,304 KB
testcase_07 AC 259 ms
8,896 KB
testcase_08 AC 162 ms
7,032 KB
testcase_09 AC 154 ms
7,016 KB
testcase_10 AC 289 ms
9,488 KB
testcase_11 AC 24 ms
4,380 KB
testcase_12 AC 200 ms
6,420 KB
testcase_13 AC 169 ms
6,972 KB
testcase_14 AC 41 ms
4,380 KB
testcase_15 AC 62 ms
4,820 KB
testcase_16 AC 21 ms
4,380 KB
testcase_17 AC 166 ms
6,920 KB
testcase_18 AC 41 ms
4,380 KB
testcase_19 AC 75 ms
5,040 KB
testcase_20 AC 307 ms
9,796 KB
testcase_21 AC 308 ms
9,596 KB
testcase_22 AC 305 ms
9,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll h, w, q;
  cin >> h >> w >> q;
  map<ll, ll> mp;
  ll ans = h * w;
  REP(_, q) {
    ll y, x;
    cin >> y >> x;
    if (!mp.count(x)) {
      ans -= h - y + 1;
      mp[x] = y;
    } else {
      ans -= max(0LL, mp[x] - y);
      mp[x] = min(mp[x], y);
    }

    cout << ans << endl;
  }
}
0