結果

問題 No.11 カードマッチ
ユーザー sggkshiosggkshio
提出日時 2016-11-13 23:39:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 847 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 50,688 KB
最終ジャッジ日時 2024-05-04 11:31:14
合計ジャッジ時間 2,009 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
50,176 KB
testcase_01 AC 38 ms
50,304 KB
testcase_02 AC 35 ms
50,304 KB
testcase_03 AC 38 ms
50,304 KB
testcase_04 AC 38 ms
50,432 KB
testcase_05 AC 35 ms
50,176 KB
testcase_06 AC 41 ms
50,176 KB
testcase_07 AC 36 ms
50,688 KB
testcase_08 AC 38 ms
50,560 KB
testcase_09 AC 42 ms
50,560 KB
testcase_10 AC 39 ms
50,560 KB
testcase_11 AC 39 ms
50,560 KB
testcase_12 AC 39 ms
50,432 KB
testcase_13 AC 37 ms
50,560 KB
testcase_14 AC 40 ms
50,432 KB
testcase_15 AC 36 ms
50,176 KB
testcase_16 AC 36 ms
50,432 KB
testcase_17 AC 36 ms
50,432 KB
testcase_18 AC 35 ms
50,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>



using namespace std;


set<int>x[1000005];
bool f[1000005];

int main() {

	int w,h,n;
	cin>>w>>h>>n;
	
	
	
	int y=0;
	
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		if(!f[b])y++;
		
		f[b]=1;
		x[a].insert(b);
	}
	long long int res=0;
	for(int i=1;i<=w;i++){
		if(x[i].size())res+=h-x[i].size();
		if(!x[i].size())res+=y;

		
	//cout<<res<<endl;
	}
	cout<<res<<endl;
	
	
	

	
	return 0;
}

	
0