import sys
sys.setrecursionlimit(100000)
r,c,n=map(int,input().split())
m=[['b']*(c+1) for i in range(r+1)]
def dfs(x1,y1,x2,y2,v):
if (x1,y1) in v:
return False
if x1==x2 and y1>=y2:
return True
v.add((x1,y1))
if m[x1][y1]=='g':
if (x1+1<=r) and dfs(x1+1,y1,x2,y2,v):
return True
elif (y1+1<=c) and dfs(x1,y1+1,x2,y2,v):
return True
else:
if (y1+1<=c) and dfs(x1,y1+1,x2,y2,v):
return True
return False
for i in range(n):
a,b=map(int,input().split())
m[a][b]='g'
q=int(input())
for i in range(q):
x1,y1,x2,y2=map(int,input().split())
if dfs(x1,y1,x2,y2,set()):
print('Yes')
else:print('No')
Compilation message (stdout)
Compiling 'trampoline.py'...
=======
adding: __main__.pyc (deflated 38%)
=======
# | 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... |