結果

問題 No.1338 Giant Class
ユーザー DaYuanChi
提出日時 2021-01-19 20:05:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 197,900 KB
最終ジャッジ日時 2025-01-18 02:40:25
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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