이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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() ;
}
컴파일 시 표준 에러 (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... |