結果

問題 No.647 明太子
ユーザー IchimiyaIchimiya
提出日時 2020-06-16 00:54:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 48 ms / 4,500 ms
コード長 804 bytes
コンパイル時間 1,434 ms
コンパイル使用メモリ 168,700 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 10:45:26
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main() {
	int N, M;
	cin >> N;
	vector<pair<int, int>> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v.at(i).first >> v.at(i).second;
	}

	cin >> M;
	//cout << "M:" << M << endl;

	vector<int> v2(M);
	int max = 0;
	for (int i = 0; i < M; i++) {
		int x, y;
		cin >> x >> y;
		//cout << "x:" << x << ' ' << "y:" << y << endl;

		for (int j = 0; j < N; j++) {
			int a, b;
			a = v.at(j).first;
			b = v.at(j).second;
			//cout << "a:" << a << ' ' << "b:" << b << endl;

			if ((x <= a) && (y >= b)) v2.at(i)++;
			if (v2.at(i) > max) max = v2.at(i);
		}
	}

	if (!max) {
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < M; i++) {
		//cout << v2.at(i) << endl;

		if (v2.at(i) == max) {
			cout << i + 1 << endl;
		}
	}
}
0