結果

問題 No.11 カードマッチ
ユーザー kyuridenamidakyuridenamida
提出日時 2016-02-10 19:54:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 463 bytes
コンパイル時間 1,053 ms
コンパイル使用メモリ 158,896 KB
実行使用メモリ 17,744 KB
最終ジャッジ日時 2024-04-20 01:13:07
合計ジャッジ時間 1,752 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 5 ms
6,812 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 5 ms
11,592 KB
testcase_05 AC 4 ms
6,940 KB
testcase_06 AC 4 ms
6,944 KB
testcase_07 AC 5 ms
11,668 KB
testcase_08 AC 6 ms
13,784 KB
testcase_09 AC 6 ms
13,792 KB
testcase_10 AC 6 ms
17,744 KB
testcase_11 AC 5 ms
13,776 KB
testcase_12 AC 6 ms
15,952 KB
testcase_13 AC 6 ms
13,720 KB
testcase_14 AC 5 ms
11,720 KB
testcase_15 AC 5 ms
6,944 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 5 ms
6,948 KB
testcase_18 AC 4 ms
7,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
	
}
0