This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
vector<ll> vals(n), req(n);
FOR(i,0,n) cin >> vals[i];
FOR(i,0,n) cin >> req[i];
ll q;
cin >> q;
FOR(i,0,q){
ll a,b;
cin >> a >> b;
a--;b--;
vector<vector<ll>> sus;
FOR(j,a,b+1){
sus.push_back({vals[j], req[j]});
}
sort(sus.begin(), sus.end());
if (sus[0][0] >= sus[sus.size()-1][1]) cout << "Yes" << "\n";
else cout << "No" << "\n";
}
}
# | 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... |