Task: | Ratsun reitit |
Sender: | Kertor |
Submission time: | 2020-09-30 19:23:40 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.01 s | 1, 2, 3 | details |
#2 | RUNTIME ERROR | 0.01 s | 1, 2, 3 | details |
#3 | RUNTIME ERROR | 0.01 s | 1, 2, 3 | details |
#4 | RUNTIME ERROR | 0.01 s | 1, 2, 3 | details |
#5 | RUNTIME ERROR | 0.01 s | 1, 2, 3 | details |
#6 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#7 | RUNTIME ERROR | 0.01 s | 1, 2, 3 | details |
#8 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
#9 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
#10 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
#11 | RUNTIME ERROR | 0.01 s | 3 | details |
#12 | RUNTIME ERROR | 0.01 s | 3 | details |
#13 | RUNTIME ERROR | 0.01 s | 3 | details |
Code
#include <iostream> #include <iomanip> #include <sstream> #include <vector> #include <string> #include <bits/stdc++.h> #define ll long long int using namespace std; struct Tiles { int x, y; int Distance; Tiles() {} Tiles(int x, int y, int Distance) : x(x), y(y), Distance(Distance) {} }; int main() { int n; cin >> n; int TileArray[n][n]; int MovementX[] = {-2,-1,1,2,-2,-1,1,2}; int MovementY[] = {-1,-2,-2,-1,1,2,2,1}; int CurrentPosition[] = {1,n}; queue<Tiles> BFS_Queue; BFS_Queue.push(Tiles(CurrentPosition[0], CurrentPosition[1], 0)); Tiles CurrentTile; int X_Axis, Y_Axis; bool BFS_Visit_Bool[n+1][n+1]; for (int b = 1; b <= n; b++) { for (int m = 1; m <= n; m++) { BFS_Visit_Bool[b][m] = false; } } BFS_Visit_Bool[CurrentPosition[0]][CurrentPosition[1]] = true; while(!BFS_Queue.empty()) { CurrentTile = BFS_Queue.front(); BFS_Queue.pop(); for(int g = 0; g < 8; g++) { X_Axis = CurrentTile.x + MovementX[g]; Y_Axis = CurrentTile.y + MovementY[g]; bool WeAreOnBoard = (X_Axis >= 1 && X_Axis <= n && Y_Axis >= 1 && Y_Axis <= n); if(WeAreOnBoard && !BFS_Visit_Bool[X_Axis][Y_Axis]) { BFS_Visit_Bool[X_Axis][Y_Axis] = true; BFS_Queue.push(Tiles(X_Axis, Y_Axis, CurrentTile.Distance + 1)); TileArray[X_Axis][Y_Axis] = CurrentTile.Distance + 1; } } } TileArray[1][n] = 0; for(int y = n; y > 0; y--) { for(int x = 1; x <= n; x++) { cout << TileArray[x][y] << " "; } cout << '\n'; } }
Test details
Test 1
Group: 1, 2, 3
Verdict: RUNTIME ERROR
input |
---|
4 |
correct output |
---|
0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
user output |
---|
(empty) |
Test 2
Group: 1, 2, 3
Verdict: RUNTIME ERROR
input |
---|
5 |
correct output |
---|
0 3 2 3 2 3 4 1 2 3 2 1 4 3 2 3 2 3 2 3 2 3 2 3 4 |
user output |
---|
(empty) |
Test 3
Group: 1, 2, 3
Verdict: RUNTIME ERROR
input |
---|
6 |
correct output |
---|
0 3 2 3 2 3 3 4 1 2 3 4 2 1 4 3 2 3 3 2 3 2 3 4 2 3 2 3 4 3 ... |
user output |
---|
(empty) |
Test 4
Group: 1, 2, 3
Verdict: RUNTIME ERROR
input |
---|
7 |
correct output |
---|
0 3 2 3 2 3 4 3 4 1 2 3 4 3 2 1 4 3 2 3 4 3 2 3 2 3 4 3 2 3 2 3 4 3 4 ... |
user output |
---|
(empty) |
Test 5
Group: 1, 2, 3
Verdict: RUNTIME ERROR
input |
---|
8 |
correct output |
---|
0 3 2 3 2 3 4 5 3 4 1 2 3 4 3 4 2 1 4 3 2 3 4 5 3 2 3 2 3 4 3 4 2 3 2 3 4 3 4 5 ... |
user output |
---|
(empty) |
Test 6
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
9 |
correct output |
---|
0 3 2 3 2 3 4 5 4 3 4 1 2 3 4 3 4 5 2 1 4 3 2 3 4 5 4 3 2 3 2 3 4 3 4 5 2 3 2 3 4 3 4 5 4 ... |
user output |
---|
0 3 2 3 2 3 4 5 4 5 4 1 2 3 4 3 4 0 2 1 4 3 2 3 4 0 9 3 2 3 2 3 4 3 4 0 2 3 2 5 4 3 4 ... Truncated |
Test 7
Group: 1, 2, 3
Verdict: RUNTIME ERROR
input |
---|
10 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 3 4 1 2 3 4 3 4 5 6 2 1 4 3 2 3 4 5 4 5 3 2 3 2 3 4 3 4 5 6 2 3 2 3 4 3 4 5 4 5 ... |
user output |
---|
(empty) |
Test 8
Group: 2, 3
Verdict: RUNTIME ERROR
input |
---|
25 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 9
Group: 2, 3
Verdict: RUNTIME ERROR
input |
---|
49 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 10
Group: 2, 3
Verdict: RUNTIME ERROR
input |
---|
50 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 11
Group: 3
Verdict: RUNTIME ERROR
input |
---|
75 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 12
Group: 3
Verdict: RUNTIME ERROR
input |
---|
99 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 13
Group: 3
Verdict: RUNTIME ERROR
input |
---|
100 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
Error:
*** stack smashing detected ***: <unknown> terminated