結果

問題 No.1338 Giant Class
ユーザー 沙耶花沙耶花
提出日時 2021-01-15 21:36:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 2,645 ms
コンパイル使用メモリ 205,900 KB
実行使用メモリ 9,612 KB
最終ジャッジ日時 2023-08-17 16:21:37
合計ジャッジ時間 7,262 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 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,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 172 ms
7,256 KB
testcase_07 AC 260 ms
8,920 KB
testcase_08 AC 160 ms
6,964 KB
testcase_09 AC 150 ms
6,704 KB
testcase_10 AC 281 ms
9,436 KB
testcase_11 AC 25 ms
4,380 KB
testcase_12 AC 195 ms
6,564 KB
testcase_13 AC 162 ms
6,912 KB
testcase_14 AC 42 ms
4,376 KB
testcase_15 AC 62 ms
4,932 KB
testcase_16 AC 21 ms
4,376 KB
testcase_17 AC 165 ms
6,984 KB
testcase_18 AC 40 ms
4,380 KB
testcase_19 AC 77 ms
5,032 KB
testcase_20 AC 301 ms
9,596 KB
testcase_21 AC 301 ms
9,612 KB
testcase_22 AC 295 ms
9,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

int main(){
	
	long long H,W,Q;
	cin>>H>>W>>Q;
	
	long long ans = H*W;
	
	map<long long,long long> mp;
	
	rep(_,Q){
		long long X,Y;
		cin>>X>>Y;
		
		if(mp.count(Y)){
			if(mp[Y]>X){
				ans -= mp[Y]-1;
				mp[Y] = X;
				ans += X-1;
			}
				
		}
		else{
			ans -= H;
			mp[Y] = X;
			ans += X-1;
		}
		cout<<ans<<endl;
	}
	
    return 0;
}
0