File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import sys
2+
3+ input = sys .stdin .readline
4+ output = sys .stdout .write
5+
6+ while line := input ().strip ():
7+ n , m = map (int , line .split ())
8+ x = y = 0
9+
10+ terrain = []
11+ for _ in range (n ):
12+ terrain .append (list (map (int , input ().split ())))
13+
14+ for index_row , row in enumerate (terrain [1 :- 1 ], 1 ):
15+ for index_cell , cell in enumerate (row [1 :- 1 ], 1 ):
16+ if (
17+ cell == 42
18+ and terrain [index_row - 1 ][index_cell - 1 ] == 7
19+ and terrain [index_row - 1 ][index_cell ] == 7
20+ and terrain [index_row - 1 ][index_cell + 1 ] == 7
21+ and terrain [index_row ][index_cell - 1 ] == 7
22+ and terrain [index_row ][index_cell + 1 ] == 7
23+ and terrain [index_row + 1 ][index_cell - 1 ] == 7
24+ and terrain [index_row + 1 ][index_cell ] == 7
25+ and terrain [index_row + 1 ][index_cell + 1 ] == 7
26+ ):
27+ x = index_row + 1
28+ y = index_cell + 1
29+ break
30+
31+ if x and y :
32+ break
33+
34+ output (f'{ x } { y } \n ' )
You can’t perform that action at this time.
0 commit comments