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>
#define fastio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define int long long
using namespace std ;
bool a[3000][3000] ;
signed main ()
{
fastio ;
int r , c , n , x , y , t , sx , sy , ex , ey ;
cin >> r >> c >> n ;
while ( n-- )
{
cin >> x >> y ;
a[x][y] = 1 ;
}
cin >> t ;
while ( t-- )
{
cin >> sx >> sy >> ex >> ey ;
if ( sx > ex || sy > ey ) { cout << "NO\n" ; continue ; }
while ( sx != ex && sy != ey && sx <= r && sy < c )
{
if ( a[sx][sy] ) sx++ ;
else sy++ ;
}
sx == ex ? cout << "YES\n" : cout << "NO\n" ;
}
return 0 ;
}
# | 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... |