結果

問題 No.1338 Giant Class
ユーザー DaYuanChiDaYuanChi
提出日時 2021-01-19 20:05:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 205,356 KB
実行使用メモリ 9,616 KB
最終ジャッジ日時 2023-08-22 16:35:06
合計ジャッジ時間 6,863 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 200 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 164 ms
7,400 KB
testcase_07 AC 237 ms
9,000 KB
testcase_08 AC 153 ms
7,240 KB
testcase_09 AC 146 ms
6,764 KB
testcase_10 AC 265 ms
9,568 KB
testcase_11 AC 24 ms
4,376 KB
testcase_12 AC 190 ms
6,560 KB
testcase_13 AC 156 ms
6,972 KB
testcase_14 AC 41 ms
4,380 KB
testcase_15 AC 61 ms
4,824 KB
testcase_16 AC 21 ms
4,380 KB
testcase_17 AC 159 ms
6,944 KB
testcase_18 AC 41 ms
4,380 KB
testcase_19 AC 73 ms
4,980 KB
testcase_20 AC 277 ms
9,612 KB
testcase_21 AC 280 ms
9,616 KB
testcase_22 AC 286 ms
9,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  ll h, w; cin >> h >> w;
  int q; cin >> q;
  map<ll, ll> mp;
  ll ans = h*w;
  for(int i = 0; i < q; i++){
    ll y, x; cin >> y >> x;
    ll y1;
    if(mp.find(x)!= mp.end()) y1 = mp[x];
    else y1 = h+1;
    if(y1 > y){
      ans -= y1-y;
      mp[x] = y;
    }
    cout << ans << endl;
  }
  return 0;
}
                              
0