結果

問題 No.647 明太子
ユーザー AqFvAqFv
提出日時 2018-02-09 23:14:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 39 ms / 4,500 ms
コード長 892 bytes
コンパイル時間 1,192 ms
コンパイル使用メモリ 70,408 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 09:27:00
合計ジャッジ時間 2,427 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 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,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 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,376 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 29 ms
4,380 KB
testcase_15 AC 6 ms
4,380 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 37 ms
4,380 KB
testcase_18 AC 39 ms
4,380 KB
testcase_19 AC 8 ms
4,380 KB
testcase_20 AC 7 ms
4,380 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 AC 26 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define rep(i, a, n) for(int i = a;i < n;i++)
#define repe(i, a, n) for(int i = a;i <= n;i++)
#define repr(i, a, n) for(int i = a;i > n;i--)
using namespace std;


int n, m;
int a[10010], b[10100];
int x[1010], y[1010];
pair<int, int> vote[1010];


void solve(){
	repe(i, 1, m) vote[i].second = i;
	repe(i, 1, n)
		repe(j, 1, m)
			if(x[j] <= a[i] && b[i] <= y[j]) vote[j].first++;
	sort(&vote[1], &vote[m+1]);
	vector<int> men;
	if(!vote[m].first){ cout << 0 << endl; return; }
	men.push_back(vote[m].second);
	repr(i, m-1, 0){
		if(vote[i].first != vote[i+1].first) break;
		men.push_back(vote[i].second);
	}
	sort(men.begin(), men.end());
	for(auto i : men) cout << i << endl;
}


int main(){
	cin >> n;
	repe(i, 1, n) cin >> a[i] >> b[i];
	cin >> m;
	repe(i, 1, m) cin >> x[i] >> y[i];

	solve();

	return 0;
}
0