結果

問題 No.1338 Giant Class
ユーザー どららどらら
提出日時 2021-01-15 22:08:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 1,487 ms
コンパイル使用メモリ 172,752 KB
実行使用メモリ 8,076 KB
最終ジャッジ日時 2024-05-05 00:00:06
合計ジャッジ時間 5,635 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 179 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 132 ms
5,836 KB
testcase_07 AC 193 ms
8,076 KB
testcase_08 AC 124 ms
5,644 KB
testcase_09 AC 114 ms
5,644 KB
testcase_10 AC 213 ms
7,944 KB
testcase_11 AC 22 ms
5,376 KB
testcase_12 AC 147 ms
5,504 KB
testcase_13 AC 126 ms
5,648 KB
testcase_14 AC 34 ms
5,376 KB
testcase_15 AC 50 ms
5,376 KB
testcase_16 AC 18 ms
5,376 KB
testcase_17 AC 128 ms
5,768 KB
testcase_18 AC 33 ms
5,376 KB
testcase_19 AC 62 ms
5,376 KB
testcase_20 AC 231 ms
7,952 KB
testcase_21 AC 223 ms
7,948 KB
testcase_22 AC 261 ms
7,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll H, W, Q;
  cin >> H >> W >> Q;

  unordered_map<ll,ll> memo;
  
  ll ret = H * W;
  rep(q,Q){
    ll y, x;
    cin >> y >> x;

    ll idx = memo[x];
    
    if(idx == 0) idx = H+1;

    if(y < idx){
      ret -= idx-1;
      ret += y-1;
      memo[x] = y;
    }
    cout << ret << endl;
  }
  
  return 0;
}

0