| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1346178 | yc11 | Gift Exchange (JOI24_ho_t4) | C++20 | 0 ms | 356 KiB |
#include<bits/stdc++.h>
using namespace std;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,q;
cin>>n;
vector<int> n1;
n1.resize(n);
vector<int> n2;
n2.resize(n);
for (int i = 0;i<n;i++) cin>>n1[i];
for (int i = 0;i<n;i++) cin>>n2[i];
cin>>q;
for (int q1 = 0;q1<q;q1++){
int l,r;
cin>>l>>r;
l--;
r--;
priority_queue<pair<int,int> > pqa;
priority_queue<pair<int,int> > pqb;
for (int i = l;i<=r;i++){
pqa.push(make_pair(n1[i],i));
pqb.push(make_pair(n2[i],i));
}
bool hi = true;
while (!pqb.empty()){
pair<int,int> save = pqa.top();
if (save.second==pqb.top().second){
pqa.pop();
if (pqa.empty() or pqa.top().first<pqb.top().first){hi = false;break;}
pqa.pop();
pqb.pop();
pqa.push(save);
}
else{
if (pqa.empty() or pqa.top().first<pqb.top().first){hi = false;break;}
pqa.pop();
pqb.pop();
}
}
if (hi==false) cout<<"No\n";
else cout<<"Yes\n";
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
