結果

問題 No.11 カードマッチ
ユーザー prog470prog470
提出日時 2016-08-27 16:44:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,463 ms / 5,000 ms
コード長 741 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 81,524 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 06:27:13
合計ジャッジ時間 8,110 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 635 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1,054 ms
6,940 KB
testcase_07 AC 33 ms
6,940 KB
testcase_08 AC 654 ms
6,944 KB
testcase_09 AC 1,463 ms
6,940 KB
testcase_10 AC 595 ms
6,944 KB
testcase_11 AC 604 ms
6,944 KB
testcase_12 AC 635 ms
6,940 KB
testcase_13 AC 482 ms
6,940 KB
testcase_14 AC 616 ms
6,944 KB
testcase_15 AC 6 ms
6,944 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 6 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include<unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>

using namespace std;

int main() {

	int W, H, N, S[105], K[105];
	cin >> W >> H >> N;
	for (int i = 0; i < N; i++) {
		cin >> S[i] >> K[i];
	}

	long long  ans = 0;
	unordered_set<int> s1, s2;
	for (int i = 0; i < W; i++) {
		int cnt = 0;
		bool flag = false;
		for (int j = 0; j<N; j++) {
			if (S[j] == i + 1) {
				cnt++;
				flag = true;
			}
			s2.insert(K[j]);
		}
		if (flag) {
			ans += H - cnt;
			s1.insert(i + 1);
			flag = false;
		}
	}

	ans += (W - s1.size())*s2.size();

	cout << ans << endl;

	return 0;
}
0