Submission details
Task:Robotti
Sender:alli
Submission time:2026-01-17 13:14:48 +0200
Language:C++ (C++20)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.01 sdetails
#60.29 sdetails

Code

#include<bits/stdc++.h>

typedef long long ll;
using namespace std;

char c[21][21];
int n, k = 0;
int d = -2;

void haku(int x, int y){
    if (x == n && y == n+1) return;
    cout << x << " " << y << " " << d << "\n";
    k++;
    if (c[y][x] == '\\'){
        c[y][x] = '/';
        if (d == -2){
            d = 1;
            haku(x+1,y);
        }
        else if (d == 2){
            d = -1;
            haku(x-1,y);
        }
        else if (d == 1){
            d = -2;
            haku(x,y+1);
        }
        else if (d == -1){
            d = 2;
            haku(x,y-1);
        }
    }
    else if (c[y][x] == '/'){
        c[y][x] = '\\';
        if (d == -2){
            d = -1;
            haku(x-1,y);
        }
        else if (d == 2){
            d = 1;
            haku(x+1,y);
        }
        else if (d == 1){
            d = 2;
            haku(x,y-1);
        }
        else if (d == -1){
            d = -2;
            haku(x,y+1);
        }
    }
    else if (c[y][x] == '.'){
        if (d == -2)haku(x,y+1);
        else if (d == 2) haku(x,y-1);
        else if (d == 1) haku(x+1,y);
        else if (d == -1) haku(x-1,y);
    }
}

int main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            cin >> c[i][j];
        }
    }
    haku(1,1);
    cout << k << "\n";
}

Test details

Test 1 (public)

Verdict:

input
3
./\
\./
\/.

correct output
13

user output
1 1 -2
1 2 -2
2 2 1
3 2 1
3 1 2
...

Feedback: Output is longer than expected

Test 2

Verdict:

input
1
.

correct output
1

user output
1 1 -2
1

Feedback: Output is longer than expected

Test 3

Verdict:

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

correct output
25

user output
1 1 -2
1 2 -2
1 3 -2
1 4 -2
1 5 -2
...

Feedback: Output is longer than expected

Test 4

Verdict:

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

correct output
37

user output
1 1 -2
2 1 1
2 2 -2
3 2 1
3 1 2
...

Feedback: Output is longer than expected

Test 5

Verdict:

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

correct output
2519

user output
1 1 -2
2 1 1
2 2 -2
3 2 1
3 3 -2
...

Feedback: Output is longer than expected

Test 6

Verdict:

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

correct output
917489

user output
1 1 -2
2 1 1
2 2 -2
3 2 1
3 3 -2
...

Feedback: Output is longer than expected