Submission details
Task:Robotti
Sender:Nyno
Submission time:2026-01-17 14:51:57 +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.04 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:23:9: warning: unused variable 'nx' [-Wunused-variable]
   23 |     int nx = 0;
      |         ^~
input/code.cpp:24:9: warning: unused variable 'ny' [-Wunused-variable]
   24 |     int ny = 0;
      |         ^~

Code

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    int l=0;
    cin >> n;
    int x=0,y=0,dx=0,dy=1;
    vector<string> v;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        v.push_back(s);
    }
    int nx = 0;
    int ny = 0;
    while(x >= 0 && x < n && y >= 0 && y < n) { 

        string s = v[y];
        if(v[y][x] == '/') {
            if (dx == 1) {
                dy = -1;
                dx = 0;
            }else if (dx == -1){
                dy = 1;
                dx = 0;
            }else if (dy == -1){
                dy = 0;
                dx = 1;
            }else if (dy == 1){
                dy = 0;
                dx = -1;
            }
        }
        if(v[y][x] == '\\') {
            if (dx == 1) {
                dy = 1;
                dx = 0;
            }else if (dx == -1){
                dy = -1;
                dx = 0;
            }else if (dy == -1){
                dy = 0;
                dx = -1;
            }else if (dy == 1){
                dy = 0;
                dx = 1;
            }
        }
        l++;
        v[y][x] = (v[y][x] == '/') ? '\\' : (v[y][x] == '\\') ? '/' : '.';

        x +=dx;
        y +=dy;

    }


    cout << l;
    

    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