| Task: | Robotti |
| Sender: | Nyno |
| Submission time: | 2026-01-17 14:22:18 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | RUNTIME ERROR | 0.00 s | details |
| #3 | ACCEPTED | 0.00 s | details |
| #4 | WRONG ANSWER | 0.00 s | details |
| #5 | WRONG ANSWER | 0.00 s | details |
| #6 | WRONG ANSWER | 0.00 s | details |
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=1;
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((nx >= 0 && nx < n)&&(ny >= 0 && ny < n)) {
nx = x+dx;
ny = y+dy;
if (v[ny][nx] == '/') {
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[ny][nx] == '\\') {
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++;
if (ny+dy < 0 || ny+dy >= n || nx+dx < 0 || nx+dx >= n) {
break;
}
v[y][x] = (v[y][x] == '/') ? '\\' : (v[y][x] == '\\') ? '/' : '.';
x = nx;
y = ny;
}
cout << l;
return 0;
}Test details
Test 1 (public)
Verdict: ACCEPTED
| input |
|---|
| 3 ./\ \./ \/. |
| correct output |
|---|
| 13 |
| user output |
|---|
| 13 |
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 1 . |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 5 ./\/\ ..... ..... ..... ... |
| correct output |
|---|
| 25 |
| user output |
|---|
| 25 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 5 \\/\\ /\/\/ \\/\\ /\/\/ ... |
| correct output |
|---|
| 37 |
| user output |
|---|
| 2 |
Feedback: Incorrect character on line 1 col 1: expected "37", got "2"
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 20 \\/\/\/\\./\\.\/\/\. /\\\\\\/\\\\\\\\\\\. \\\\\\\\\\\\\\\\\\\\ /\\\\\\\\\\\\\.\\\\\ ... |
| correct output |
|---|
| 2519 |
| user output |
|---|
| 2 |
Feedback: Incorrect character on line 1 col 2: expected "2519", got "2"
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 20 \\.................. .\\..............\\. ..\\............\\.. ...\\..........\\... ... |
| correct output |
|---|
| 917489 |
| user output |
|---|
| 19 |
Feedback: Incorrect character on line 1 col 1: expected "917489", got "19"
