Task: | Ruudukko |
Sender: | jannejal |
Submission time: | 2019-10-01 18:13:45 +0300 |
Language: | Node.js |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.42 s | details |
#2 | ACCEPTED | 0.43 s | details |
#3 | ACCEPTED | 0.43 s | details |
#4 | ACCEPTED | 0.52 s | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
Code
let readline = require('readline'); var r = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false }); let input = null; r.on('line', line => { input = line; run(input); process.exit(); }); const run = line => { const times = Number(line); const ret = new Array(times).fill(0); ret.forEach((r, i) => ret[i] = new Array(times).fill(0)); for (let y = 0; y < times; y++) { for (let x = 0; x < times; x++) { ret[y][x] = minInVertical(ret, x, y); } console.log(ret[y].join(" ")); } }; const minInVertical = (ret, x, y) => { let alku = 1; while (ret.map(r => r[x]).some(r => r === alku) || ret[y].some(r => r === alku)) alku++; return alku; };
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: ACCEPTED
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
1 2 2 1 |
Test 3
Verdict: ACCEPTED
input |
---|
5 |
correct output |
---|
1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
user output |
---|
1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
Test 4
Verdict: ACCEPTED
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |