add to gothib
This commit is contained in:
commit
523f45b46a
28 changed files with 419 additions and 0 deletions
27
magic_barrier.py
Normal file
27
magic_barrier.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import sys
|
||||
|
||||
barrier = {}
|
||||
|
||||
rows, columns, questions = [int(x) for x in input("").split()]
|
||||
|
||||
for row in range(rows):
|
||||
line = sys.stdin.readline()
|
||||
for (column, value) in enumerate(map(int, line.split(" "))):
|
||||
barrier[value] = (row+1, column+1)
|
||||
|
||||
# print(barrier)
|
||||
|
||||
for i in range(questions):
|
||||
k, minrow, mincol, maxrow, maxcol = (int(x) for x in sys.stdin.readline().split(" "))
|
||||
|
||||
if k not in barrier:
|
||||
print("no")
|
||||
continue
|
||||
|
||||
row, col = barrier[k]
|
||||
|
||||
if (minrow <= row <= maxrow) and (mincol <= col <= maxcol):
|
||||
print("yes")
|
||||
continue
|
||||
|
||||
print("no")
|
Loading…
Add table
Add a link
Reference in a new issue