#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m, k, t;
ll d[5007][5007];
char a[5007][5007];
void clear_me(){
for(int i = 0; i <= n; i++)
for(int j = 0; j <= m;j ++)
d[i][j] = 0;
}
int main(){
cin >> n >> m >> k;
for(int i = 0; i <= n; i++)
for(int j = 0; j <= m; j++)
a[i][j] = 'B';
for(int i = 0; i < k; i++){
ll aa, bb;
cin >> aa >> bb;
a[aa][bb] = 'G';
}
cin >> t;
while(t--){
clear_me();
ll x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
if(m > 5007 || n > 5007){
cout << "No" << endl;
continue;
}
d[x1][y1] = 1;
for(int i = min(x1, x2); i <= max(x1, x2); i++){
for(int j = min(y1, y2); j <= max(y1, y2); j++){
if(d[i][j - 1] == 1 || (a[i - 1][j] == 'G' && d[i - 1][j] == 1))
d[i][j] = 1;
}
}
if(d[x2][y2] == 1)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
2252 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
9 ms |
1740 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
8 ms |
2124 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2082 ms |
71548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
364 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |