Task: | Ruudukko |
Sender: | aleksih |
Submission time: | 2019-09-30 15:18:43 +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.01 s | details |
#6 | WRONG ANSWER | 0.01 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: `i` --> input/code.rs:20:9 | 20 | for i in 0..koko { | ^ help: consider prefixing with an underscore: `_i`
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); } let mut sar_pienin_sallittu = Vec::with_capacity(koko); for i in 0..koko { sar_pienin_sallittu.push(1); } for i in 0..koko { let mut riv_pienin_sallittu = 1; for j in 0..koko { let valittu = std::cmp::max(riv_pienin_sallittu, sar_pienin_sallittu[j]); if valittu == sar_pienin_sallittu[j] { sar_pienin_sallittu[j] += 1; } if valittu == riv_pienin_sallittu { riv_pienin_sallittu += 1; } ruudukko[i][j] = valittu; } } 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 2 3 4 3 2 1 2 3 4 3 2 1 2 5 4 3 2 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 |