結果

問題 No.11 カードマッチ
ユーザー めうめう🎒めうめう🎒
提出日時 2016-03-30 10:12:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 845 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 72,596 KB
実行使用メモリ 7,800 KB
最終ジャッジ日時 2023-08-02 00:21:31
合計ジャッジ時間 1,581 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

int card_mark[1000010] = {};
bool used_mark[1000010] = {};
bool used_num[1000010] = {};
int main() {
	ll w,h,n,s,k;
	cin >> w >> h >> n;
	for(int i = 0;i < w;i++){
		card_mark[i] = h;
	}
	for(int i = 0;i < n;i++){
		cin >> s >> k;
		s--,k--;
		card_mark[s]--;
		used_mark[s] = true;
		used_num[k] = true;
	}

	ll ans = 0,ans2 = 0,memo = 0;
	for(int i = 0;i < h;i++){
		if(used_num[i]) memo++;
	}
	for(int i = 0;i < w;i++){
		if(card_mark[i] != h) ans += card_mark[i];
		if(used_mark[i]) continue;
		ans2 += memo;
	}
	cout << ans + ans2 << endl;
	return 0;
}
0