結果
問題 |
No.647 明太子
|
ユーザー |
![]() |
提出日時 | 2018-02-10 17:55:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 41 ms / 4,500 ms |
コード長 | 774 bytes |
コンパイル時間 | 500 ms |
コンパイル使用メモリ | 63,392 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 02:39:17 |
合計ジャッジ時間 | 1,420 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include<iostream> #include<vector> #include<utility> #include<algorithm> #include<cstring> using namespace std; typedef pair<int,int> P; int main(){ int n,m,x,y,max=0; //入力--------------------- cin>> n; vector<P> vec(n); for(int i=0;i<n;i++){ cin>>vec[i].first>>vec[i].second; } //------------------------ cin>>m; vector<P> mentai(m); for(int i=0;i<m;i++){mentai[i].first=0;mentai[i].second=i;} for(int i=0;i<m;i++){ cin>>x>>y; for(int j=0;j<n;j++){ if(vec[j].first>=x&&vec[j].second<=y){ mentai[i].first++; if(max<mentai[i].first) max=mentai[i].first; } } } if(max==0) cout<<0<<"\n"; else{ for(int i=0;i<m;i++){ if(max==mentai[i].first) cout<<mentai[i].second+1<<"\n"; } } }