結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  kyuridenamida | 
| 提出日時 | 2016-02-10 19:54:01 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 8 ms / 5,000 ms | 
| コード長 | 463 bytes | 
| コンパイル時間 | 1,225 ms | 
| コンパイル使用メモリ | 159,016 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-11 20:01:19 | 
| 合計ジャッジ時間 | 2,025 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
int row[1000100];
int col[1000100];
signed main(){
	int W,H;
	cin >> W >> H;
	int N;
	cin >> N;
	int ans = 0;
	for(int i = 0 ; i < N ; i++){
		int x,y;
		cin >> x >> y;
		row[y]++;
		col[x]++;
	}
	int r = 0;
	for(int i = 0 ; i <= 1000000 ; i++){
		if( row[i] ) ans += W - row[i], r++;
	}
	for(int i = 0 ; i <= 1000000 ; i++){
		if( col[i] ) ans += H - col[i] - r;
	}
	cout << ans+N << endl;
	
}
            
            
            
        