結果

問題 No.647 明太子
ユーザー forest3forest3
提出日時 2020-04-06 16:28:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 813 bytes
コンパイル時間 1,799 ms
コンパイル使用メモリ 172,336 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-20 17:37:44
合計ジャッジ時間 3,481 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,500 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
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 AC 6 ms
4,376 KB
testcase_20 AC 5 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
	int N;
	cin >> N;
	vector<int> A( N );
	vector<int> B( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i] >> B[i];
	}
	int M;
	cin >> M;
	vector<pair<int, int>> XY( M );
	for( int i = 0; i < M; i++ ) {
		cin >> XY[i].first >> XY[i].second;
	}

	sort( XY.begin(), XY.end() );
	vector<int> v( M );
	for( int i = 0; i < N; i++ ) {
		int j = lower_bound( XY.begin(), XY.end(), make_pair( A[i], 0 ) ) - XY.begin();
		if( j == 0 && XY[j].first > A[i] ) continue;
		if( j >= M ) j--;
		for( ; j >= 0; j-- ) {
			if( XY[j].second < B[i] ) continue;
			v[j]++;
		}
	}
	int ma = *max_element( v.begin(), v.end() );

	if( ma == 0 ) {
		cout << 0 << endl;
	}
	else {
		for( int i = 0; i < M; i++ ) {
			if( v[i] < ma ) continue;
			cout << i + 1 << endl;
		}
	}
}
0