結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
夕叢霧香(ゆうむらきりか)
|
| 提出日時 | 2018-02-09 22:29:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 4,500 ms |
| コード長 | 706 bytes |
| コンパイル時間 | 749 ms |
| コンパイル使用メモリ | 79,984 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 02:28:15 |
| 合計ジャッジ時間 | 1,689 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)
int main(){
int n;
cin>>n;
vi a(n),b(n);
rep(i,n)cin>>a[i]>>b[i];
int m;
cin>>m;
vi x(m),y(m),c(m);
rep(i,m)cin>>x[i]>>y[i];
rep(i,n){
rep(j,m){
if(x[j]<=a[i]&&y[j]>=b[i])c[j]++;
}
}
vector<pii>t;
rep(i,m){
t.push_back(pii(-c[i],i+1));
}
sort(t.begin(),t.end());
int cnt=0;
rep(i,m){
if(i==0||t[i].first==t[i-1].first){
if(t[i].first==0)break;
cout<<t[i].second<<endl;
cnt++;
}else{
break;
}
}
if(cnt==0)cout<<0<<endl;
}
夕叢霧香(ゆうむらきりか)