結果

問題 No.647 明太子
ユーザー dgd1724dgd1724
提出日時 2018-07-23 22:40:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 941 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 65,844 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-29 22:03:47
合計ジャッジ時間 2,027 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>

int main() {

	//std::ifstream inf("Text.txt");	std::cin.rdbuf(inf.rdbuf());

	int N;
	std::cin >> N;
	std::vector<int> A(N), B(N);
	int max_price = 0;
	int min_hot = 100000000;

	for (int i = 0; i < N; i++) {
		std::cin >> A[i] >> B[i];
		if (A[i] > max_price) {
			max_price = A[i];
		}
		if (B[i] < min_hot) {
			min_hot = B[i];
		}
	}

	int M;
	std::cin >> M;
	std::vector<int> X(M), Y(M), ans(M);

	for (int i = 0; i < M; i++) {
		std::cin >> X[i] >> Y[i];
	}

	for (int i = 0; i < M; i++) {
		if (X[i] > max_price) {
			continue;
		}
		if (Y[i] < min_hot) {
			continue;
		}

		for (int j = 0; j < N; j++) {
			if (X[i] <= A[j]) {
				if (Y[i] >= B[j]) {
					ans[i]++;
				}
			}
		}

	}
	
	int max = *std::max_element(ans.begin(), ans.end());

	for (int i = 0; i < M; i++) {
		if (ans[i] == max) {
			std::cout << i + 1 << std::endl;
		}
	}

	return 0;
}
0