結果

問題 No.1338 Giant Class
ユーザー startcppstartcpp
提出日時 2021-01-15 23:10:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 797 ms
コンパイル使用メモリ 75,588 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2023-08-17 18:22:21
合計ジャッジ時間 5,791 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 199 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,376 KB
testcase_06 AC 164 ms
7,268 KB
testcase_07 AC 238 ms
8,972 KB
testcase_08 AC 154 ms
7,028 KB
testcase_09 AC 145 ms
6,824 KB
testcase_10 AC 281 ms
9,532 KB
testcase_11 AC 24 ms
4,384 KB
testcase_12 AC 190 ms
6,436 KB
testcase_13 AC 153 ms
6,884 KB
testcase_14 AC 40 ms
4,380 KB
testcase_15 AC 58 ms
4,888 KB
testcase_16 AC 20 ms
4,380 KB
testcase_17 AC 164 ms
6,912 KB
testcase_18 AC 39 ms
4,376 KB
testcase_19 AC 71 ms
5,160 KB
testcase_20 AC 294 ms
9,568 KB
testcase_21 AC 293 ms
9,728 KB
testcase_22 AC 297 ms
9,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#define int long long
using namespace std;

int h, w, q;
int y, x;
map<int, int> mp;

signed main() {
	cin >> h >> w >> q;
	
	int ans = h * w;
	for (int i = 0; i < q; i++) {
		cin >> y >> x; y--;
		if (mp.find(x) == mp.end()) {
			mp[x] = y;
			ans = ans - h + y;
		}
		else if (mp[x] > y) {
			ans = ans + y - mp[x];
			mp[x] = y;
		}
		cout << ans << endl;
	}
	return 0;
}
0