| Task: | Robotti |
| Sender: | rottis |
| Submission time: | 2026-01-17 13:06:18 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 100 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | ACCEPTED | 0.00 s | details |
| #3 | ACCEPTED | 0.00 s | details |
| #4 | ACCEPTED | 0.00 s | details |
| #5 | ACCEPTED | 0.00 s | details |
| #6 | ACCEPTED | 0.01 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
string b[20];
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 0; i < n; i++) {
string row;
cin >> row;
b[i] = row;
}
int y = 0, x = 0, yv = 1, xv = 0;
int steps = 0;
while (y >= 0 && y < n && x >= 0 && x < n) {
if (b[y][x] == '/') {
if (xv == 1) {
yv = -1;
xv = 0;
} else if (xv == -1) {
yv = 1;
xv = 0;
} else if (yv == 1) {
xv = -1;
yv = 0;
} else {
xv = 1;
yv = 0;
}
b[y][x] = '\\';
} else if (b[y][x] == '\\') {
if (xv == 1) {
yv = 1;
xv = 0;
} else if (xv == -1) {
yv = -1;
xv = 0;
} else if (yv == 1) {
xv = 1;
yv = 0;
} else {
xv = -1;
yv = 0;
}
b[y][x] = '/';
}
y += yv; x += xv;
steps++;
}
cout << steps;
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 |
