#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main(){
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]=0;
}
}
for(int i=0; i<n; i++){
int a, b; cin >> a >> b; a--; b--;
g[a][b]= 1;
}
for(int i=0; i<r; i++){
for(int j=0; j<c; j++){
if(i==0&&j==0){continue;}
if(i==0){g[i][j]= g[i][j]+ g[i][j-1]; continue;}
if(j==0){g[i][j]= g[i][j]+ g[i-1][j]; continue;}
g[i][j]= g[i][j]+ g[i-1][j]+ g[i][j-1]- g[i-1][j-1];
}
}
/*
for(int i=0; i<r; i++){
for(int j=0; j<c; j++){
cout << g[i][j] << " ";
}cout << endl;
}*/
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--;
if(a>c||b>d){cout << "No" << endl; continue;}
int lol=0;
if(a==0&&b==0){lol= g[c][d];}
else if(a==0){lol= g[c][d]- g[c][b-1];}
else if(b==0){lol= g[c][d]- g[a-1][d];}
else{lol= g[c][d]- g[c][b-1]- g[a-1][d]+ g[a-1][b-1];}
int e= c-a;
if(lol>=e){cout << "Yes" << endl;}
else{cout << "No" << endl;}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
552 KB |
expected NO, found YES [2nd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
147 ms |
50964 KB |
expected NO, found YES [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
556 ms |
1048580 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
430 ms |
1048580 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
423 ms |
1048580 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |