Submission details
Task:Robotti
Sender:Linuzzik
Submission time:2026-01-17 13:28:15 +0200
Language:C++ (C++11)
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;

int main() {
    int n; cin >> n;
    vector<vector<int>> w(n, vector<int>(n));

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            char c; cin >> c;
            if (c == '.') {}
            else if (c == '/') w[i][j] = 2;
            else w[i][j] = 1;
        }
    }

    int y = 0, x = 0;
    int dx = 0, dy = 1;
    int t = 0;
    while (x < n && y < n && x >= 0 && y >= 0) {
        if (w[y][x] == 1) {
            if (dx != 0) {
                dy = dx;
                dx = 0;
            } else if (dy != 0) {
                dx = dy;
                dy = 0;
            }
            w[y][x] = 2;
        } else if (w[y][x] == 2) {
            if (dx != 0) {
                dy = -dx;
                dx = 0;
            } else if (dy != 0) {
                dx = -dy;
                dy = 0;
            }
            w[y][x] = 1;
        }
        y += dy; x += dx;
        t++;
    }
    cout << t << "\n";
}

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