Task: | Ratsun reitit |
Sender: | bruh420 |
Submission time: | 2020-10-02 17:55:56 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#3 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#4 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#5 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#6 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#7 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#8 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#9 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#10 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#11 | WRONG ANSWER | 0.01 s | 3 | details |
#12 | WRONG ANSWER | 0.01 s | 3 | details |
#13 | WRONG ANSWER | 0.01 s | 3 | details |
Compiler report
input/code.cpp: In function 'bool oleva(Piste, int)': input/code.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
Code
// g++ -std=c++11 -O2 -Wall ratsunreitit.cpp -o ratsunreitit #include<bits/stdc++.h> using namespace std; struct Piste { int x, y, matka; }; bool oleva(Piste p, int koko) { if(p.x < 0 || p.y < 0) return false; else if(p.x >= koko || p.y >= koko) return false; } vector<Piste>naapurit(Piste p, int koko) { int xliike[] { +1, +2, +2, +1, -1, -2, -2, -1 }; int yliike[] { -2, -1, +1, +2, +2, +1, -1, -2 }; vector<Piste> ret; for(int i = 0; i < 8; i ++) { Piste tyo; tyo.x = p.x + xliike[i]; tyo.y = p.y + yliike[i]; if(oleva(tyo, koko)) { ret.push_back(tyo); } } return ret; } int main() { int koko; cin >> koko; if(koko < 4) return -1; int ruudukko[koko][koko]; vector<Piste> jono; for( int y = 0; y < koko; y++) { for( int x = 0; x < koko; x++) { ruudukko[x][y] = INT_MAX; Piste tyo; tyo.x = x; tyo.y = y; jono.push_back(tyo); } } ruudukko[0][0] = 0; while(!jono.empty()) { Piste p = jono.back(); jono.pop_back(); for(auto & n : naapurit(p, koko)) { if(ruudukko[n.x][n.y] > ruudukko[p.x][p.y]) { ruudukko[n.x][n.y] = ruudukko[p.x][p.y] + 1; jono.push_back(n); } } } for(int i = 0; i < koko; i++) { ruudukko[i][0] = ruudukko[0][i]; } for(int y = 0; y < koko; y++) { for(int x = 0; x < koko; x++) { cout << ruudukko[x][y] << " "; } cout << endl; } }
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
4 |
correct output |
---|
0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
user output |
---|
0 2147483647 2147483647 214748... Truncated |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
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 |
---|
0 2147483647 2147483647 214748... Truncated |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
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 |
---|
0 2147483647 2147483647 214748... Truncated |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
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 |
---|
0 2147483647 2147483647 214748... Truncated |
Test 5
Group: 1, 2, 3
Verdict: WRONG ANSWER
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 |
---|
0 2147483647 2147483647 214748... Truncated |
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 2147483647 2147483647 214748... Truncated |
Test 7
Group: 1, 2, 3
Verdict: WRONG ANSWER
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 |
---|
0 2147483647 2147483647 214748... Truncated |
Test 8
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
25 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
0 2147483647 2147483647 214748... Truncated |
Test 9
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
49 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
0 2147483647 2147483647 214748... Truncated |
Test 10
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
50 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
0 2147483647 2147483647 214748... Truncated |
Test 11
Group: 3
Verdict: WRONG ANSWER
input |
---|
75 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
0 2147483647 2147483647 214748... Truncated |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
99 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
0 2147483647 2147483647 214748... Truncated |
Test 13
Group: 3
Verdict: WRONG ANSWER
input |
---|
100 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
0 2147483647 2147483647 214748... Truncated |