#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
using namespace std;
ll r,c,n,t;
vector<vector<char> > grid;
vector<vector<bool> > explored;
bool explore( ll x1, ll y1, ll x2, ll y2 ){
if( x1 == x2 && y1 == y2 ){ return true; }
else if ( x1 == r-1 && y1 == c-1 ){ return false; }
else if ( x1 > x2 || y1 > y2 ){ return false; }
else{
bool kaya = false;
if ( y1 != c-1 ){ kaya = kaya || explore( x1, y1+1, x2, y2 ); }
if ( x1 != r-1 && grid[x1][y1] == 'G' ){ kaya = kaya || explore(x1+1,y1,x2,y2); }
return kaya;
}
}
void solve(){
// start with ST1
cin >> r >> c >> n;
grid.resize(r);
explored.resize(r);
for( int i = 0; i < r; i++ ){ explored[i].resize(c,false); grid[i].resize(c,'B'); }
while(n--){
ll x,y; cin >> x >> y; x--; y--;
grid[x][y] = 'G';
}
cin >> t;
while(t--){
for( int i = 0; i < r; i++ ){ for( int j = 0; j < c; j++ ){ explored[i][j] = false; } }
ll x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2; x1--; y1--; x2--; y2--;
cout << ( explore(x1,y1,x2,y2) ? "Yes" : "No" ) << endl;
}
return;
}
int main(){
//freopen( "input.txt", "r", stdin );
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t = 1; //cin>>t;
while(t--){ solve(); }
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2085 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2079 ms |
7544 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
588 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
588 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
588 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |