This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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
print(V[posicion[0]][posicion[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
if L.index(min(L))!=0:
print(":)")
min=10000000
for xd in L:
if xd<min and xd!=0:
min=xd
print(uwu[min])
else:
print(":(")
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |