結果

問題 No.11 カードマッチ
ユーザー 西尾西尾
提出日時 2018-03-20 14:53:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 1,456 ms
コンパイル使用メモリ 163,940 KB
実行使用メモリ 7,932 KB
最終ジャッジ日時 2023-09-06 01:10:42
合計ジャッジ時間 2,275 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,396 KB
testcase_01 AC 2 ms
5,460 KB
testcase_02 AC 2 ms
5,404 KB
testcase_03 AC 2 ms
5,460 KB
testcase_04 AC 4 ms
7,836 KB
testcase_05 AC 2 ms
5,540 KB
testcase_06 AC 6 ms
5,596 KB
testcase_07 AC 4 ms
5,744 KB
testcase_08 AC 5 ms
7,776 KB
testcase_09 AC 6 ms
7,932 KB
testcase_10 AC 6 ms
7,736 KB
testcase_11 AC 5 ms
7,840 KB
testcase_12 AC 6 ms
7,756 KB
testcase_13 AC 6 ms
7,624 KB
testcase_14 AC 4 ms
7,716 KB
testcase_15 AC 2 ms
5,452 KB
testcase_16 AC 2 ms
5,596 KB
testcase_17 AC 3 ms
5,620 KB
testcase_18 AC 3 ms
5,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int iW[ 1000010 ];
int iH[ 1000010 ];

int main()
{
int i;
int W;
int H;
int N;
int S;
int K;
int iSum;
int iCntW;
int iCntH;

	cin >> W;
	cin >> H;
	cin >> N;

	for( i = 0; i < N; i++ )
	{
		cin >> S;
		cin >> K;
		iW[ S ]++;
		iH[ K ]++;
	}

	iCntW = 0;
	for( i = 1; i <= W; i++ )
	{
		if( iW[ i ] > 0 ) iCntW++;
	}

	iCntH = 0;
	for( i = 1; i <= H; i++ )
	{
		if( iH[ i ] > 0 ) iCntH++;
	}
	

	cout << iCntH * W + iCntW * H - iCntH * iCntW - N << endl;

	return 0;
}




0