結果

問題 No.11 カードマッチ
ユーザー DadarithmDadarithm
提出日時 2015-10-04 23:13:15
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 591 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 70,096 KB
実行使用メモリ 813,968 KB
最終ジャッジ日時 2023-09-27 02:02:38
合計ジャッジ時間 3,539 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

int main()
{
	int W, H, N; vector<vector<bool>> card;
	cin >> W >> H >> N;
	card.resize(W);
	for (int i = 0; i < W; ++i)
		card[i].assign(H, false);
	for (int i = 0; i < N; ++i)
	{
		int s, k;
		cin >> s >> k;
		for (int i = 0; i < W; ++i)
			card[i][k - 1] = true;
		for (int i = 0; i < H; ++i)
			card[s - 1][i] = true;
	}

	ll ans = -N;
	for (int i = 0; i < W; ++i)
	{
		ans += count_if(card[i].begin(), card[i].end(), [](bool x){ return x; });
	}

	cout << ans << endl;

	return 0;
}
0