제출 #1127775

#제출 시각아이디문제언어결과실행 시간메모리
112777512345678Gift Exchange (JOI24_ho_t4)C++20
10 / 100
2594 ms2916 KiB
#include <bits/stdc++.h> using namespace std; const int nx=1e5+5; int n, q, a[nx], b[nx], l, r, mx; vector<int> mp, v; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) cin>>a[i]; for (int i=1; i<=n; i++) cin>>b[i]; cin>>q; while (q--) { cin>>l>>r; mp.clear(); v.clear(); for (int i=l; i<=r; i++) mp.push_back(a[i]), mp.push_back(b[i]); sort(mp.begin(), mp.end()); for (int i=l; i<=r; i++) v.push_back(upper_bound(mp.begin(), mp.end(), a[i])-mp.begin()); sort(v.begin(), v.end()); int f=0; for (int i=0; i<(r-l); i++) { if (v[i]==2*(i+1)) { f=1; cout<<"No\n"; break; } } if (!f) cout<<"Yes\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...