結果

問題 No.11 カードマッチ
ユーザー sggkshio
提出日時 2016-11-13 23:39:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 87,496 KB
実行使用メモリ 50,816 KB
最終ジャッジ日時 2024-11-25 22:07:20
合計ジャッジ時間 1,962 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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