Submission details
Task:Robotti
Sender:rottis
Submission time:2026-01-17 13:06:18 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int n;
string b[20];
int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);

    cin >> n;

    for (int i = 0; i < n; i++) {
        string row;
        cin >> row;
        b[i] = row;
    }

    int y = 0, x = 0, yv = 1, xv = 0;
    int steps = 0;

    while (y >= 0 && y < n && x >= 0 && x < n) {
        if (b[y][x] == '/') {
            if (xv == 1) {
                yv = -1;
                xv = 0;
            } else if (xv == -1) {
                yv = 1;
                xv = 0;
            } else if (yv == 1) {
                xv = -1;
                yv = 0;
            } else {
                xv = 1;
                yv = 0;
            }
            b[y][x] = '\\';
        } else if (b[y][x] == '\\') {
            if (xv == 1) {
                yv = 1;
                xv = 0;
            } else if (xv == -1) {
                yv = -1;
                xv = 0;
            } else if (yv == 1) {
                xv = 1;
                yv = 0;
            } else {
                xv = -1;
                yv = 0;
            }
            b[y][x] = '/';
        }

        y += yv; x += xv;
        steps++;
        
    }

    cout << steps;

    return 0;
}

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: ACCEPTED

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

correct output
37

user output
37

Test 5

Verdict: ACCEPTED

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

correct output
2519

user output
2519

Test 6

Verdict: ACCEPTED

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

correct output
917489

user output
917489