Submission details
Task:Robotti
Sender:Verlet
Submission time:2026-01-17 13:18:30 +0200
Language:C++ (C++20)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails

Code

#include <iostream>
#include <string>

using namespace std;

struct v2
{
    int x;
    int y;
};

int main()
{
    int n; cin >> n;

    string m[n];
    for (string & s : m)
        cin >> s;
    
    // for (string & s : m)
    //    cout << s << endl;

    int c = 0;
    v2 r = {0, 0};
    v2 d = {0, 1};
    while (true)
    {
        // for (int y = 0; y < n; y++)
        // {
        //     for (int x = 0; x < n; x++)
        //     {
        //         if (x == r.x && y == r.y)
        //             cout << 'X' << " ";
        //         else cout << m[y][x] << " ";
        //     }
        //     cout << endl;
        // }
        // cout << endl;

        if (c > 13)
            break;

        if (r.x <  0 || r.x >= n || r.y < 0 || r.y >= n)
            break;
        
        if (m[r.y][r.x] == '/')
        {
            m[r.y][r.x] = '\\';

            if (d.x == 1)
            {
                d.x = 0; d.y = -1;
            }
            else if (d.x == -1)
            {
                d.x = 0; d.y = 1;
            }
            else if (d.y == 1)
            {
                d.y = 0; d.x = -1;
            }
            else if (d.y == -1)
            {
                d.y = 0; d.x = 1;
            }
        }
        else if (m[r.y][r.x] == '\\')
        {
            m[r.y][r.x] = '/';

            if (d.x == 1)
            {
                d.x = 0; d.y = 1;
            }
            else if (d.x == -1)
            {
                d.x = 0; d.y = -1;
            }
            else if (d.y == 1)
            {
                d.y = 0; d.x = 1;
            }
            else if (d.y == -1)
            {
                d.y = 0; d.x = -1;
            }
        }

        r.x += d.x;
        r.y += d.y;

        c++;
    }

    cout << c << endl;
}

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:

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

correct output
25

user output
14

Feedback: Incorrect character on line 1 col 1: expected "25", got "14"

Test 4

Verdict:

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

correct output
37

user output
14

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

Test 5

Verdict:

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

correct output
2519

user output
14

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

Test 6

Verdict:

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

correct output
917489

user output
14

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