結果

問題 No.11 カードマッチ
ユーザー 西尾西尾
提出日時 2018-03-20 14:44:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 508 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 165,264 KB
実行使用メモリ 7,804 KB
最終ジャッジ日時 2023-09-06 00:51:50
合計ジャッジ時間 2,335 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,464 KB
testcase_01 AC 2 ms
5,404 KB
testcase_02 AC 2 ms
5,404 KB
testcase_03 AC 2 ms
5,384 KB
testcase_04 AC 4 ms
7,712 KB
testcase_05 AC 2 ms
5,448 KB
testcase_06 AC 5 ms
5,412 KB
testcase_07 AC 3 ms
5,928 KB
testcase_08 AC 4 ms
7,780 KB
testcase_09 AC 6 ms
7,800 KB
testcase_10 AC 5 ms
7,692 KB
testcase_11 AC 5 ms
7,804 KB
testcase_12 AC 5 ms
7,784 KB
testcase_13 AC 5 ms
7,752 KB
testcase_14 AC 4 ms
7,724 KB
testcase_15 AC 2 ms
5,660 KB
testcase_16 AC 2 ms
5,724 KB
testcase_17 AC 2 ms
5,688 KB
testcase_18 AC 3 ms
5,588 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;

	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++;
	}

	iSum = 0;
	for( i = 1; i <= H; i++ )
	{
		if( iH[ i ] > 0 )
			iSum += W - iH[ i ];
		else
			iSum += iCntW;
	}

	cout << iSum << endl;

	return 0;
}


0