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

Code

#include <bits/stdc++.h>
using namespace std;
int n;
char t[20][20];
int s {};
void search(int x, int y, int d)
{
    ++s;
    if(x == n || x == -1 || y == n || y == -1) return;
    if(t[x][y] == '.')
    {
        if(d == 0) search(x, y + 1, d);
        else if(d == 1) search(x, y - 1, d);
        else if(d == 2) search(x + 1, y, d);
        else search(x - 1, y, d);
    }
    else if(t[x][y] == '/')
    {
        if(d == 0) search(x - 1, y, 3);
        if(d == 1) search(x + 1, y, 2);
        if(d == 2) search(x, y - 1, 1);
        if(d == 3) search(x, y + 1, 0);
    }
    else
    {
        if(d == 1) search(x - 1, y, 3);
        if(d == 0) search(x + 1, y, 2);
        if(d == 3) search(x, y - 1, 1);
        if(d == 2) search(x, y + 1, 0);
    }
}
int main()
{
    cin >> n;
    for(int i {}; i < n; ++i)
        for(int j {}; j < n; ++j)
            cin >> t[j][i];
    search(0, 0, 0);
    cout << s + 2;
}

Test details

Test 1 (public)

Verdict: ACCEPTED

input
3
./\
\./
\/.

correct output
13

user output
13

Test 2

Verdict:

input
1
.

correct output
1

user output
4

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

Test 3

Verdict:

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

correct output
25

user output
28

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

Test 4

Verdict:

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

correct output
37

user output
13

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

Test 5

Verdict:

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

correct output
2519

user output
115

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

Test 6

Verdict:

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

correct output
917489

user output
89

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