답안 #914978

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914978 2024-01-23T04:58:59 Z vjudge1 Patkice (COCI20_patkice) Python 3
0 / 50
11 ms 2908 KB
def mov(posicion,V):
  con=1
  while True:
    if(V[posicion[0]][posicion[1]]=="x"):
      return con
    elif(V[posicion[0]][posicion[1]]=="."):
      return 0
    elif(V[posicion[0]][posicion[1]]==">"):
      posicion[1]=posicion[1]+1
      con+=1
    elif(V[posicion[0]][posicion[1]]=="<"):
      posicion[1]=posicion[1]-1
      con+=1
    elif(V[posicion[0]][posicion[1]]=="v"):
      posicion[0]=posicion[0]+1
      con+=1
    else:
      posicion[0]=posicion[0]-1
      con+=1
a,b=map(int,input().split())
V=[]
for i in range(a):
  N=input()
  V.append(N)
for j in V:
  for k in j:
    if k=="o":
      isla=[V.index(j),j.index(k)]
      L=[]
N=mov([isla[0]-1,isla[1]],V)
S=mov([isla[0]+1,isla[1]],V)
E=mov([isla[0],isla[1]+1],V)
O=mov([isla[0],isla[1]-1],V)
uwu=["N","S","E","O"]
L.append(N)
L.append(S)
L.append(E)
L.append(O)
max=1000000
com=False
for jsjs in L:
  if jsjs!=0:
    com=True
    break
if com:
  print(":)")
  min=10000000
  for xd in L:
    if xd<min and xd!=0:
      min=xd
  print(uwu[min])
else:
  print(":(")
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 2908 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 2908 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -