CSES - Datatähti 2021 alku - Results
Submission details
Task:Ratsun reitit
Sender:intoo
Submission time:2020-09-28 00:38:41 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.01 s1, 2, 3details
#30.01 s1, 2, 3details
#40.01 s1, 2, 3details
#50.01 s1, 2, 3details
#60.01 s1, 2, 3details
#70.01 s1, 2, 3details
#80.22 s2, 3details
#9--2, 3details
#10--2, 3details
#11--3details
#12--3details
#13--3details

Code

#include <iostream>
#include <queue>
using namespace std;
int t[101][101];
int e[101][101];
int o[101][101];
int main() {
int n;
queue<pair<int,int>> q;
cin >> n;
q.push({0, 0});
e[0][0] = -1;
while (!q.empty()) {
auto p = q.front();
q.pop();
int y = p.first;
int x = p.second;
t[y][x] = e[y][x]+1;
o[y][x] = 1;
for (int i = -2; i <= 2; i++) {
if (!i) continue;
if (y+i >= 0 && y+i < n) {
if (x+2/i >= 0 && x+2/i < n) {
if (o[y+i][x+2/i]) continue;
q.push({y+i, x+2/i});
e[y+i][x+2/i] = t[y][x];
}
if (x-2/i >= 0 && x-2/i < n) {
if (o[y+i][x-2/i]) continue;
q.push({y+i, x-2/i});
e[y+i][x-2/i] = t[y][x];
}
}
}
}
for (int y = 0; y < n; y++) {
for (int x = 0; x < n; x++) {
cout << t[y][x] << ' ';
}
cout << "\n";
}
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
4

correct output
0 3 2 5 
3 4 1 2 
2 1 4 3 
5 2 3 2 

user output
0 3 4 5 
3 4 1 2 
2 1 4 3 
5 2 3 2 

Test 2

Group: 1, 2, 3

Verdict:

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 3 4 3 4 
3 4 1 2 5 
2 1 4 3 2 
3 2 3 2 3 
2 3 2 3 4 

Test 3

Group: 1, 2, 3

Verdict:

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 3 4 3 4 3 
3 4 1 2 5 4 
2 1 4 3 2 3 
3 2 3 2 3 4 
2 3 2 3 4 3 
...

Test 4

Group: 1, 2, 3

Verdict:

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 3 4 3 4 3 4 
3 4 1 2 5 4 5 
2 1 4 3 2 3 4 
3 2 3 2 3 4 3 
2 3 2 3 4 3 4 
...
Truncated

Test 5

Group: 1, 2, 3

Verdict:

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 3 4 3 4 3 4 0 
3 4 1 2 5 4 5 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 
...
Truncated

Test 6

Group: 1, 2, 3

Verdict:

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 4 3 4 3 4 7 0 
3 4 1 2 5 4 5 4 5 
2 1 4 3 2 3 4 5 6 
3 2 3 2 3 4 3 4 5 
2 3 2 3 4 3 4 
...
Truncated

Test 7

Group: 1, 2, 3

Verdict:

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 3 4 3 4 3 4 7 6 7 
3 4 1 2 5 4 5 4 5 8 
2 1 4 3 2 3 4 5 6 5 
3 2 3 2 3 4 3 4 5 6 
2 3 2 
...
Truncated

Test 8

Group: 2, 3

Verdict:

input
25

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
0 3 4 3 4 3 4 7 6 7 6 7 10 9 1...
Truncated

Test 9

Group: 2, 3

Verdict:

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:

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:

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:

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:

input
100

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
(empty)