結果

問題 No.11 カードマッチ
ユーザー dgd1724dgd1724
提出日時 2016-11-01 06:45:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 237 ms / 5,000 ms
コード長 742 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 161,848 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 20:35:00
合計ジャッジ時間 3,152 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 68 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 145 ms
6,940 KB
testcase_07 AC 84 ms
6,944 KB
testcase_08 AC 126 ms
6,940 KB
testcase_09 AC 237 ms
6,940 KB
testcase_10 AC 108 ms
6,944 KB
testcase_11 AC 126 ms
6,940 KB
testcase_12 AC 138 ms
6,940 KB
testcase_13 AC 124 ms
6,940 KB
testcase_14 AC 77 ms
6,944 KB
testcase_15 AC 3 ms
6,944 KB
testcase_16 AC 10 ms
6,940 KB
testcase_17 AC 10 ms
6,940 KB
testcase_18 AC 10 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());	

	int W = 0, H = 0, N = 0, S = 0, K = 0, ans = 0;
	std::cin >> W >> H >> N;

	std::vector<bool> mark(W, true), number(H, true);

	for (int i = 0; i < N; i++) {
		std::cin >> S >> K;
		if (mark[S - 1]) {
			ans += std::count(number.begin(), number.end(), true) - 1;
			mark[S - 1] = false;
		}
		else {
			ans--;
		}
		if (number[K - 1]) {
			ans += std::count(mark.begin(), mark.end(), true);
			number[K - 1] = false;
		}
	}

	std::cout << ans << std::endl;

}

0