結果

問題 No.11 カードマッチ
ユーザー sggkshiosggkshio
提出日時 2016-11-13 23:39:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 81,452 KB
実行使用メモリ 50,760 KB
最終ジャッジ日時 2023-08-17 04:29:57
合計ジャッジ時間 2,095 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
50,188 KB
testcase_01 AC 20 ms
50,524 KB
testcase_02 AC 20 ms
50,400 KB
testcase_03 AC 20 ms
50,272 KB
testcase_04 AC 23 ms
50,364 KB
testcase_05 AC 19 ms
50,196 KB
testcase_06 AC 25 ms
50,204 KB
testcase_07 AC 20 ms
50,496 KB
testcase_08 AC 22 ms
50,556 KB
testcase_09 AC 24 ms
50,528 KB
testcase_10 AC 23 ms
50,388 KB
testcase_11 AC 23 ms
50,448 KB
testcase_12 AC 24 ms
50,568 KB
testcase_13 AC 23 ms
50,760 KB
testcase_14 AC 23 ms
50,376 KB
testcase_15 AC 20 ms
50,220 KB
testcase_16 AC 20 ms
50,332 KB
testcase_17 AC 20 ms
50,484 KB
testcase_18 AC 21 ms
50,340 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