Submission details
Task:Robotti
Sender:Username*
Submission time:2026-01-17 14:09:22 +0200
Language:Python3 (CPython3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.02 sdetails
#2ACCEPTED0.02 sdetails
#3ACCEPTED0.02 sdetails
#40.02 sdetails
#50.02 sdetails
#60.02 sdetails

Code

n = int(input())

steps = 0

grid = [[""]]*n

#print(grid)

for i in range(n):
    grid[i]=list(input())

loc = (0,-1)
move = (0,1)
s = True

#In addition, when the robot leaves a cell, the turn is inversed.

while True:
    loc = (loc[0]+move[0], loc[1]+move[1])
    steps += 1
    if(loc[0] < 0 or loc[1] < 0 or loc[0] > n-1 or loc[1] > n-1):
        break
    if not s:
        curCell = grid[loc[1]][loc[0]]
    else:
        curCell = "."
        s = False
    if (curCell == "/"):
        move = (-move[1], -move[0])
        grid[loc[1]][loc[0]] = "\\"
    elif (curCell == "\\"):
        move = (move[1], move[0])
        grid[loc[1]][loc[0]] = "/"
    #for row in grid:
    #    print(row)
    #print("loc", loc)
    #print("cell", curCell)
    #print("nextmove", move)

print(steps-1)

Test details

Test 1 (public)

Verdict: ACCEPTED

input
3
./\
\./
\/.

correct output
13

user output
13

Test 2

Verdict: ACCEPTED

input
1
.

correct output
1

user output
1

Test 3

Verdict: ACCEPTED

input
5
./\/\
.....
.....
.....
...

correct output
25

user output
25

Test 4

Verdict:

input
5
\\/\\
/\/\/
\\/\\
/\/\/
...

correct output
37

user output
2

Feedback: Incorrect character on line 1 col 1: expected "37", got "2"

Test 5

Verdict:

input
20
\\/\/\/\\./\\.\/\/\.
/\\\\\\/\\\\\\\\\\\.
\\\\\\\\\\\\\\\\\\\\
/\\\\\\\\\\\\\.\\\\\
...

correct output
2519

user output
2

Feedback: Incorrect character on line 1 col 2: expected "2519", got "2"

Test 6

Verdict:

input
20
\\..................
.\\..............\\.
..\\............\\..
...\\..........\\...
...

correct output
917489

user output
19

Feedback: Incorrect character on line 1 col 1: expected "917489", got "19"