Task: | Ratsun reitit |
Sender: | Lookas123 |
Submission time: | 2020-10-11 19:42:39 +0300 |
Language: | Node.js |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.44 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.44 s | 1, 2, 3 | details |
#3 | WRONG ANSWER | 0.44 s | 1, 2, 3 | details |
#4 | WRONG ANSWER | 0.44 s | 1, 2, 3 | details |
#5 | WRONG ANSWER | 0.44 s | 1, 2, 3 | details |
#6 | WRONG ANSWER | 0.44 s | 1, 2, 3 | details |
#7 | WRONG ANSWER | 0.44 s | 1, 2, 3 | details |
#8 | WRONG ANSWER | 0.47 s | 2, 3 | details |
#9 | WRONG ANSWER | 0.56 s | 2, 3 | details |
#10 | WRONG ANSWER | 0.56 s | 2, 3 | details |
#11 | WRONG ANSWER | 0.81 s | 3 | details |
#12 | TIME LIMIT EXCEEDED | -- | 3 | details |
#13 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
var readline = require('readline'); const r = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false }); let grid=[]; let gridsize; let checking = []; r.on('line', function (line) { gridsize = Number(line); let array=[]; for (let i = 0; i < gridsize; i++) { array.push(Infinity); } for (let i = 0; i < gridsize; i++) { grid.push([...array]); } grid[0][0]=0; checking.push([0,0,0]) while(checking.length > 0){ if(checking[0]!==0){ for(let i in checking){ let me = checking[i] if(i > 0 && arrayIsArray(me,checking[0])){ checking[i]=0; } } checkpointall(checking[0][0],checking[0][1],checking[0][2]); } checking.shift(); } for(let item of grid){ console.log(item.join(" ")); } }); function arrayIsArray(arr1, arr2) { if(arr1.length !== arr2.length) return false; for(var i = arr1.length; i--;) { if(arr1[i] !== arr2[i]) return false; } return true; } function setpoint(x, y, amount){ if(x<0 || x>=gridsize || y<0 || y>=gridsize || grid[y][x] < amount) return false; grid[y][x]=amount; return true; } function checkpointall(x,y,amount){ if(x<0 || x>=gridsize || y<0 || y>=gridsize || grid[y][x] < amount) return; for(let i of [[x+2, y+1],[x+2, y+1],[x+2, y-1],[x+1, y+2],[x+1, y-2],[x-1, y+2],[x-1, y-2],[x-2, y+1],[x-2, y+1]]){ if(setpoint(i[0],i[1],amount+1)) checking.push([i[0], i[1], amount+1]) } }
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
4 |
correct output |
---|
0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
user output |
---|
0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
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 3 2 3 2 3 4 1 2 3 2 1 4 3 2 5 2 3 2 3 2 3 2 3 4 |
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 3 2 3 2 3 3 4 1 2 3 4 2 1 4 3 2 3 5 2 3 2 3 4 2 3 2 3 4 3 ... |
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 3 2 3 2 3 4 3 4 1 2 3 4 3 2 1 4 3 2 3 4 5 2 3 2 3 4 3 2 3 2 3 4 3 4 ... 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 3 2 3 2 3 4 5 3 4 1 2 3 4 3 4 2 1 4 3 2 3 4 5 5 2 3 2 3 4 3 4 2 3 2 3 4 3 4 5 ... 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 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 5 2 3 2 3 4 3 4 5 2 3 2 3 4 3 4 5 4 ... 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 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 5 2 3 2 3 4 3 4 5 6 2 3 2 3 4 ... 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 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... 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 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... 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 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... 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 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
Test 12
Group: 3
Verdict: TIME LIMIT EXCEEDED
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: TIME LIMIT EXCEEDED
input |
---|
100 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |