結果
問題 | No.647 明太子 |
ユーザー |
![]() |
提出日時 | 2018-02-09 22:42:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 43 ms / 4,500 ms |
コード長 | 1,010 bytes |
コンパイル時間 | 1,276 ms |
コンパイル使用メモリ | 161,676 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 02:31:38 |
合計ジャッジ時間 | 2,444 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; //constant const long long int inf = 1<<30; const int N = 1e4+1; const int M = 1e3+1; //variable int cnt_ment[M]; int a[N],b[N]; int x[M],y[M]; //function int main() { int n,m; 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]){ cnt_ment[j]++; } } } vector<int> ans; int maxi=-1; for(int i=0; i<m; i++){ int pre=maxi; maxi=max(maxi,cnt_ment[i]); if(pre!=maxi){ ans.clear(); } if(maxi==cnt_ment[i]){ ans.push_back(i); } } if(maxi==0){ cout<<0<<endl; return 0; } for(int i=0; i<ans.size(); i++){ cout<<ans[i]+1<<endl; } /*for(int i=0; i<m; i++){ cout<<cnt_ment[i]<<' '; }*/ return 0; }