結果

問題 No.11 カードマッチ
ユーザー umaumaxumaumax
提出日時 2017-05-07 17:33:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 618 ms / 5,000 ms
コード長 598 bytes
コンパイル時間 1,006 ms
コンパイル使用メモリ 68,036 KB
実行使用メモリ 97,128 KB
最終ジャッジ日時 2023-10-12 16:11:36
合計ジャッジ時間 6,019 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 222 ms
43,076 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 618 ms
97,128 KB
testcase_07 AC 178 ms
35,072 KB
testcase_08 AC 257 ms
51,796 KB
testcase_09 AC 564 ms
97,108 KB
testcase_10 AC 443 ms
78,920 KB
testcase_11 AC 394 ms
71,380 KB
testcase_12 AC 418 ms
74,592 KB
testcase_13 AC 370 ms
69,084 KB
testcase_14 AC 187 ms
38,968 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 14 ms
6,836 KB
testcase_17 AC 15 ms
7,052 KB
testcase_18 AC 14 ms
6,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>

using namespace std;

int main(int argc, const char* argv[])
{
	int W, H;
	int N;
	cin >> W >> H >> N;
	map<int, bool> wm;
	map<int, bool> hm;
	uint64_t cnt = 0;
	int S[N];
	int K[N];
	for (int i				 = 0; i < N; i++) cin >> S[i] >> K[i];
	for (auto&& s : S) wm[s] = true;
	for (auto&& k : K) hm[k] = true;
	uint64_t hms			 = hm.size();
	uint64_t wms			 = wm.size();
	for (int i = 1; i <= W; i++)
		if (wm[i]) cnt += H - hms;
	for (int i = 1; i <= H; i++)
		if (hm[i]) cnt += W - wms;
	//	重複削除分
	cnt += hms * wms - N;
	cout << cnt << endl;
	return 0;
}
0