結果

問題 No.1338 Giant Class
ユーザー startcppstartcpp
提出日時 2021-01-15 23:10:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 272 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 640 ms
コンパイル使用メモリ 75,632 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-05-05 01:04:20
合計ジャッジ時間 5,100 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 201 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 153 ms
7,552 KB
testcase_07 AC 237 ms
9,088 KB
testcase_08 AC 147 ms
7,168 KB
testcase_09 AC 146 ms
6,784 KB
testcase_10 AC 256 ms
9,600 KB
testcase_11 AC 22 ms
5,376 KB
testcase_12 AC 165 ms
6,528 KB
testcase_13 AC 143 ms
7,040 KB
testcase_14 AC 37 ms
5,376 KB
testcase_15 AC 57 ms
5,376 KB
testcase_16 AC 20 ms
5,376 KB
testcase_17 AC 142 ms
7,040 KB
testcase_18 AC 37 ms
5,376 KB
testcase_19 AC 67 ms
5,376 KB
testcase_20 AC 261 ms
9,728 KB
testcase_21 AC 269 ms
9,728 KB
testcase_22 AC 272 ms
9,728 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