| Task: | Robotti |
| Sender: | zli0122 |
| Submission time: | 2026-01-17 15:15:50 +0200 |
| Language: | C++ (C++11) |
| 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 |
Compiler report
input/code.cpp: In function 'void solve()':
input/code.cpp:15:10: warning: unused variable 't' [-Wunused-variable]
15 | char t;
| ^Code
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define debug(x) cout << #x << ": " << (x) << " | "
#define Debug(x) cout << #x << ": " << (x) << "\n"
const int M = 22;
char grid[M][M];
void solve() {
int n;
cin >> n;
char t;
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
cin >> grid[j][i];
}
}
int dx=0, dy=1, tmp;
int posx=0, posy=-1;
for (int ans =0; ans<1000010; ans++) {
//debug(posx); debug(posy); debug(dx); Debug(dy);
posx+= dx;
posy+= dy;
if (posx<0 || posx>=n || posy<0 || posy>=n) {
cout << ans << "\n";
return;
}
if (grid[posx][posy] == '.') continue;
if (grid[posx][posy] == '/') {
tmp = -dx;
dx = -dy;
dy = tmp;
grid[posx][posy] = '\\';
}
else if (grid[posx][posy] == '\\') {
tmp = dx;
dx = dy;
dy = tmp;
grid[posx][posy] = '/';
}
}
}
signed main() {
cin.tie(0) -> ios::sync_with_stdio(0);
solve();
}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 |
