# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1008846 |
2024-06-27T01:26:47 Z |
vjudge1 |
Patkice (COCI20_patkice) |
Python 3 |
|
12 ms |
3160 KB |
#https://dmoj.ca/problem/coci20c1p1
import sys
def num_steps(i, j, grid):
total = 0
while True:
total = total + 1
if grid[i][j] == 'x':
return total
elif grid[i][j] == 'o' or grid[i][j] == '.':
return 0
elif grid[i][j] == '^':
i = i - 1
elif grid[i][j] == 'v':
i = i + 1
elif grid[i][j] == '>':
j = j + 1
elif grid[i][j] == '<':
j = j - 1
r, c = map(int, input().split())
ocean = [list(input()) for _ in range(r)]
for i in range(r):
for j in range(c):
if ocean[i][j] == 'o':
east = num_steps(i, j + 1, ocean)
west = num_steps(i, j - 1, ocean)
north = num_steps(i - 1, j, ocean)
south = num_steps(i + 1, j, ocean)
winds = [east, north, south, west]
winds_alphabet = ['E', 'N', 'S', 'W']
if any(winds):
print(':)')
max_steps = max(winds)
for i in range(len(winds)):
if winds [i] == 0:
winds[i] = max_steps + 1
best_wind = '?'
best_wind = winds_alphabet[winds.index(min(winds))]
print(best_wind)
else:
print(':(')
sys.exit()
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
3160 KB |
Output is correct |
2 |
Correct |
11 ms |
2908 KB |
Output is correct |
3 |
Correct |
10 ms |
3100 KB |
Output is correct |
4 |
Correct |
11 ms |
2908 KB |
Output is correct |
5 |
Correct |
12 ms |
2960 KB |
Output is correct |
6 |
Correct |
11 ms |
3032 KB |
Output is correct |
7 |
Correct |
12 ms |
3064 KB |
Output is correct |
8 |
Correct |
11 ms |
3160 KB |
Output is correct |
9 |
Correct |
11 ms |
2908 KB |
Output is correct |
10 |
Correct |
12 ms |
3044 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
2908 KB |
Output is correct |
2 |
Correct |
11 ms |
2908 KB |
Output is correct |
3 |
Correct |
11 ms |
2908 KB |
Output is correct |
4 |
Correct |
11 ms |
2912 KB |
Output is correct |
5 |
Correct |
9 ms |
2908 KB |
Output is correct |
6 |
Correct |
11 ms |
2908 KB |
Output is correct |
7 |
Correct |
10 ms |
3024 KB |
Output is correct |
8 |
Correct |
10 ms |
2908 KB |
Output is correct |
9 |
Correct |
11 ms |
3080 KB |
Output is correct |
10 |
Correct |
11 ms |
2980 KB |
Output is correct |
11 |
Correct |
10 ms |
2908 KB |
Output is correct |
12 |
Correct |
10 ms |
2908 KB |
Output is correct |
13 |
Correct |
11 ms |
2908 KB |
Output is correct |
14 |
Correct |
10 ms |
2908 KB |
Output is correct |
15 |
Correct |
10 ms |
3160 KB |
Output is correct |
16 |
Correct |
11 ms |
3100 KB |
Output is correct |
17 |
Correct |
10 ms |
3024 KB |
Output is correct |
18 |
Correct |
11 ms |
2908 KB |
Output is correct |
19 |
Correct |
10 ms |
3104 KB |
Output is correct |
20 |
Correct |
10 ms |
2908 KB |
Output is correct |