結果

問題 No.1338 Giant Class
ユーザー chocono2230chocono2230
提出日時 2021-01-15 21:49:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 1,958 ms
コンパイル使用メモリ 206,984 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-05-04 23:24:54
合計ジャッジ時間 6,254 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 189 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 151 ms
6,400 KB
testcase_07 AC 221 ms
7,680 KB
testcase_08 AC 154 ms
6,144 KB
testcase_09 AC 131 ms
5,888 KB
testcase_10 AC 244 ms
8,064 KB
testcase_11 AC 22 ms
5,376 KB
testcase_12 AC 160 ms
5,760 KB
testcase_13 AC 139 ms
6,272 KB
testcase_14 AC 38 ms
5,376 KB
testcase_15 AC 57 ms
5,376 KB
testcase_16 AC 20 ms
5,376 KB
testcase_17 AC 146 ms
6,144 KB
testcase_18 AC 40 ms
5,376 KB
testcase_19 AC 68 ms
5,376 KB
testcase_20 AC 260 ms
8,192 KB
testcase_21 AC 253 ms
8,192 KB
testcase_22 AC 253 ms
8,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

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