結果

問題 No.1338 Giant Class
ユーザー 👑 NachiaNachia
提出日時 2021-01-15 21:35:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 4,769 ms
コンパイル使用メモリ 204,592 KB
実行使用メモリ 8,256 KB
最終ジャッジ日時 2023-08-17 16:17:02
合計ジャッジ時間 6,401 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 38 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 55 ms
6,580 KB
testcase_07 AC 87 ms
7,652 KB
testcase_08 AC 52 ms
6,292 KB
testcase_09 AC 47 ms
6,052 KB
testcase_10 AC 97 ms
8,040 KB
testcase_11 AC 8 ms
4,384 KB
testcase_12 AC 58 ms
5,840 KB
testcase_13 AC 54 ms
6,212 KB
testcase_14 AC 13 ms
4,468 KB
testcase_15 AC 20 ms
4,500 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 51 ms
6,144 KB
testcase_18 AC 13 ms
4,380 KB
testcase_19 AC 23 ms
4,764 KB
testcase_20 AC 96 ms
8,180 KB
testcase_21 AC 99 ms
8,240 KB
testcase_22 AC 104 ms
8,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int H,W,Q;
map<int,int> G;
LL ans=0;

int main(){
  scanf("%d%d%d",&H,&W,&Q);
  ans=LL(H)*W;
  while(Q--){
    int y,x; scanf("%d%d",&y,&x);
    int g=G[x];
    if(g==0) g=H+1;
    ans-=g;
    g=min(g,y);
    ans+=g;
    G[x]=g;
    printf("%lld\n",ans);
  }
  return 0;
}
0