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;
//void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define Xiao ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
#define int long long
#define itn int
#define endl "\n"
#define ff first
#define ss second
const int N = 2e5 + 5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e6 ;
int n , k , r , c ;
int a[2505][2505] ;
bool dfs( int i , int j , int x , int y ){
if ( i == x && j == y ) return true ;
bool f , s ;
if ( a[i][j] && i < r ) f = dfs( i+1 , j , x , y ) ;
if ( j < c )s = dfs( i , j+1 , x , y ) ;
if ( f || s ) return true ;
return false ;
}
void solve(){
cin >> r >> c >> n ;
for ( int i = 0 ; i < n ; i ++ ){
int x , y ;
cin >> x >> y ;
a[x][y] = 1 ;
}
int t ;
cin >> t ;
while ( t -- ){
int x1 , y1 , x2 , y2 ;
cin >> x1 >> y1 >> x2 >> y2 ;
if ( dfs( x1 , y1 , x2 , y2 ) ) cout << "Yes\n" ;
else cout << "No\n" ;
}
}
signed main(){
// fopn("blocks") ;
Xiao ;
int tt = 1 ;
// cin >> t ;
while ( tt -- ) solve() ;
}
Compilation message (stderr)
trampoline.cpp: In function 'bool dfs(long long int, long long int, long long int, long long int)':
trampoline.cpp:25:9: warning: 's' may be used uninitialized in this function [-Wmaybe-uninitialized]
25 | if ( f || s ) return true ;
| ~~^~~~
trampoline.cpp:25:9: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
# | 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... |