Task: | Ruudukko |
Sender: | aleksih |
Submission time: | 2019-10-02 13:08:58 +0300 |
Language: | Rust |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | WRONG ANSWER | 0.01 s | details |
#4 | WRONG ANSWER | 0.01 s | details |
#5 | WRONG ANSWER | 0.03 s | details |
#6 | WRONG ANSWER | 0.03 s | details |
Compiler report
warning: unused variable: `i` --> input/code.rs:11:9 | 11 | for i in 0..koko { | ^ help: consider prefixing with an underscore: `_i` | = note: #[warn(unused_variables)] on by default warning: unused variable: `j` --> input/code.rs:13:13 | 13 | for j in 0..koko { | ^ help: consider prefixing with an underscore: `_j` warning: unused variable: `riv_pienin_sallittu` --> input/code.rs:20:17 | 20 | let mut riv_pienin_sallittu = 1; | ^^^^^^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_riv_pienin_sallittu` warning: variable does not need to be mutable --> input/code.rs:20:13 | 20 | let mut riv_pienin_sallittu = 1; | ----^^^^^^^^^^^^^^^^^^^ | | | help: remove this `mut` | = note: #[warn(unused_mut)] on by default
Code
use std::io; fn main() { let mut koko_str = String::new(); io::stdin() .read_line(&mut koko_str).unwrap(); let koko = koko_str .trim().parse::<usize>().unwrap(); let mut ruudukko = Vec::with_capacity(koko); for i in 0..koko { let mut sar = Vec::with_capacity(koko); for j in 0..koko { sar.push(0); } ruudukko.push(sar); } for i in 0..koko { let mut riv_pienin_sallittu = 1; for j in 0..koko { let mut sar = Vec::with_capacity(koko); for k in 0..koko { sar.push(ruudukko[k][j]); } let mut arvaus = 1; for k in arvaus..koko + 1 { if !sar.contains(&k) && !ruudukko[i].contains(&k) { break; } arvaus += 1; } ruudukko[i][j] = arvaus; } } for i in 0..koko { for j in 0..koko { print!("{}", ruudukko[i][j]); if j != koko - 1 { print!(" "); } } println!(""); } }
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: WRONG ANSWER
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 6 4 3 2 1 6 5 6 6 6 1 |
Test 4
Verdict: WRONG ANSWER
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: WRONG ANSWER
input |
---|
99 |
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 6
Verdict: WRONG ANSWER
input |
---|
100 |
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 |