結果

問題 No.1338 Giant Class
ユーザー kumakumaaaaakumakumaaaaa
提出日時 2021-01-15 22:37:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 824 bytes
コンパイル時間 1,710 ms
コンパイル使用メモリ 173,120 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-05-05 00:38:58
合計ジャッジ時間 4,139 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 30 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 57 ms
7,424 KB
testcase_07 AC 85 ms
8,960 KB
testcase_08 AC 53 ms
7,040 KB
testcase_09 AC 50 ms
6,656 KB
testcase_10 AC 93 ms
9,472 KB
testcase_11 AC 8 ms
5,376 KB
testcase_12 AC 58 ms
6,400 KB
testcase_13 AC 57 ms
6,912 KB
testcase_14 AC 14 ms
5,376 KB
testcase_15 AC 21 ms
5,376 KB
testcase_16 AC 8 ms
5,376 KB
testcase_17 AC 52 ms
6,912 KB
testcase_18 AC 14 ms
5,376 KB
testcase_19 AC 25 ms
5,376 KB
testcase_20 AC 97 ms
9,600 KB
testcase_21 AC 95 ms
9,600 KB
testcase_22 AC 96 ms
9,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 2000000000000000000
#define ll long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll H, W, Q;
  cin >> H >> W >> Q;
  ll ans = W * H;
  map<ll, ll> mp;
  for (ll i = 0; i < Q; ++i) {
    ll y, x;
    cin >> y >> x;
    y -= 1, x -= 1;
    if (mp.find(x) == mp.end()) {
      mp[x] = H;
    }
    ll before = mp[x];
    ll now = y;
    chmin(mp[x], y);
    ans -= max(0ll, before - now);
    cout << ans << "\n";
  }
}
0