結果

問題 No.647 明太子
ユーザー iwltwmiwltwm
提出日時 2018-03-08 20:48:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,067 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 64,552 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 02:29:09
合計ジャッジ時間 1,528 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
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 <iostream>
using namespace std;

int main(void) {
	int i,j;
	int N;                //人数(~10000)
	int A[10000];         //i番目の人が支払える上限
	int B[10000];         //i番目の人の求める辛さの下限
	int M;                //売っている明太子の種類(~1000)
	int X[1000];          //j番の明太子の値段
	int Y[1000];          //j番の明太子の辛さ
	int kounyu[1000] = {};//j番の明太子が購入された数
	
	//初期化
	cin >> N;
	for (i = 0;i < N;i++)
		cin >> A[i] >> B[i];
	cin >> M;
	for (j = 0;j < M;j++)
		cin >> X[j] >> Y[j];
	
	//買うものを決める
	for (i = 0;i < N;i++)
		for (j = 0;j < M;j++)
			if(A[i] >= X[j] && B[i] <= Y[j])
				kounyu[j]++;
	
	//「奇跡の明太子」はいくつ買われたのか調べる
	int max = 0;
	for (j = 0;j < M;j++)
		if (kounyu[j] > max)
			max = kounyu[j];
	cout << "Max is " << max << " ." << endl;
	
	//「出力」
	if (max == 0) {
		cout << 0 << endl;
	} else { 
		for (j = 0;j < M;j++)
			if (kounyu[j] == max)
				cout << (j + 1) << endl;
	}
}
0