結果

問題 No.1338 Giant Class
ユーザー snrnsidysnrnsidy
提出日時 2021-11-10 02:24:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 492 bytes
コンパイル時間 2,314 ms
コンパイル使用メモリ 205,492 KB
実行使用メモリ 9,596 KB
最終ジャッジ日時 2023-08-12 11:24:30
合計ジャッジ時間 5,086 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 28 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 44 ms
7,308 KB
testcase_07 AC 65 ms
8,968 KB
testcase_08 AC 41 ms
7,192 KB
testcase_09 AC 38 ms
6,684 KB
testcase_10 AC 72 ms
9,436 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 48 ms
6,516 KB
testcase_13 AC 44 ms
6,892 KB
testcase_14 AC 11 ms
4,380 KB
testcase_15 AC 16 ms
4,740 KB
testcase_16 AC 6 ms
4,384 KB
testcase_17 AC 45 ms
7,088 KB
testcase_18 AC 11 ms
4,384 KB
testcase_19 AC 20 ms
5,176 KB
testcase_20 AC 79 ms
9,596 KB
testcase_21 AC 78 ms
9,580 KB
testcase_22 AC 77 ms
9,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
 
using namespace std;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

	long long int H,W,Q;
	map <long long int,long long int> memo;
	long long int Y,X;

	cin >> H >> W >> Q;

	long long int res = H*W;

	for(int i=0;i<Q;i++)
	{
		cin >> Y >> X;
		if(memo.find(X)==memo.end())
		{
			res -= (H-Y+1);
			memo[X] = Y;
		}
		else
		{
			if(memo[X] > Y)
			{
				res -= (memo[X]-Y);
				memo[X] = Y;
			}
		}
		cout << res << '\n';

	}
    return 0;
}
0