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>
using namespace std;
#define int long long
#define endl '\n'
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int r, c, n; cin >> r >> c >> n;
int g[r][c];
for(int i=0; i<r; i++){
for(int j=0; j<c; j++){
g[i][j]= -1;
}
}
for(int i=0; i<n; i++){
int a, b; cin >> a >> b; a--; b--;
g[a][b]= b;
}
for(int i=0; i<r; i++){
for(int j=0; j<c; j++){
if(j==0){continue;}
if(g[i][j-1]>g[i][j]){g[i][j]= g[i][j-1];}
}
}
int q; cin >> q;
for(int i=0; i<q; i++){
int a, b, c, d; cin >> a >> b >> c >> d;
a--; b--; c--; d--;
bool yea= true;
if(a>c){yea= false;}
while(c>a){
if(g[c-1][d]==-1){yea= false; break;}
d= g[c-1][d];
c--;
if(d<b){yea= false; break;}
}
if(yea){cout << "Yes" << endl;}
else{cout << "No" << endl;}
}
}
# | 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... |