結果

問題 No.647 明太子
ユーザー tenkyu9
提出日時 2018-03-26 00:32:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 40 ms / 4,500 ms
コード長 773 bytes
コンパイル時間 1,112 ms
コンパイル使用メモリ 81,040 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 02:52:09
合計ジャッジ時間 1,825 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;

int main(){

	int n, a[10000], b[10000], m, x[1000], y[1000], ans[1000]={0}, num=0;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i] >> b[i];
	}
	cin >> m;
	for(int i=0; i<m; i++){
		cin >> x[i] >> y[i];
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(a[i]>=x[j] && b[i]<=y[j]){
				ans[j]++;
			}
		}
	}
	for(int i=0; i<m; i++){
		if(num<ans[i]){
			num=ans[i];
		}
	}
	if(num==0){
		cout << 0 << endl;
		return 0;
	}
	for(int i=0; i<m; i++){
		if(ans[i]==num){
			cout << i+1 << endl;
		}
	}

	return 0;
}
0