Submission #519988

#TimeUsernameProblemLanguageResultExecution timeMemory
519988QuantumK9Trampoline (info1cup20_trampoline)C++17
0 / 100
2101 ms9448 KiB
#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{ 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...