結果

問題 No.647 明太子
ユーザー PraiPrai
提出日時 2018-03-19 03:13:56
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,107 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 03:06:16
合計ジャッジ時間 2,217 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(int argc, char const *argv[])
{
	int N;								//メンバの人数
	int Ai[N],Bi[N];					//基準となる値段と辛さ
	int M;								//明太子の種類
	int Xi[M],Yi[M];					//i番目の明太子の値段と辛さ
	int sum[M];
	int max=0;
	int ans=0;
	int i,j;


	scanf("%d",&N);						//メンバの人数の入力


	for (i = 0; i < N; ++i)				//基準となる値段と辛さの入力
	{
		scanf("%d %d",&Ai[i],&Bi[i]);
	}


	scanf("%d",&M);						//明太子の種類の入力


	for (i = 0; i < M; ++i)				//i番目の明太子の値段と辛さの入力
	{
		scanf("%d %d",&Xi[i],&Yi[i]);
		sum[i]=0;
	}


	for (i = 0; i < M; ++i)			//比較
	{
		for (j = 0; j < N; ++j)
		{
			if(Xi[i] <= Ai[j] && Yi[i] >= Bi[j]){		
				sum[i]++;
			}
		}	
	}


	for (i = 0; i < M; ++i)			//sum配列の最大値を探す
	{	
		if(max < sum[i]){
			max = sum[i];
		}
	}

	
	if (max == 0)
	{
	printf("0\n");
	}else{
		for (i = 0; i < M; ++i)
		{
			if (sum[i] == max)
			{
				printf("%d\n",i+1);
			}
		}
	}
/*
3
6 4		0		
5 2		1
2 5		2
2
4 3		0		1		1
5 4		1		1	1	2
*/



	return 0;
}
0