| Task: | Ruudukko |
| Sender: | fireplank |
| Submission time: | 2022-11-02 12:14:21 +0200 |
| Language: | Rust |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #2 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #3 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #4 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
| #5 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
| #6 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
| #7 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #8 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #9 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
use std::io;
use std::thread;
fn recurse(y: usize, x: usize, array: &Vec<Vec<i32>>) -> i64 {
let mut paths = 1;
for (index, i) in array[y].iter().enumerate() {
if i < &array[y][x] {
paths += recurse(y, index, array);
}
}
for (index, i) in array.iter().enumerate() {
if i[x] < array[y][x] {
paths += recurse(index, x, array);
}
}
return paths;
}
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let input: i32 = input.trim().parse().unwrap();
let mut array = Vec::new();
for _ in 0..input {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let input: Vec<i32> = input.split_whitespace().map(|x| x.parse().unwrap()).collect();
array.push(input);
}
let mut handles = Vec::new();
let start = std::time::Instant::now();
let mut paths: i64 = 0;
for i in 0..input {
let array = array.clone();
let handle = thread::spawn(move || {
let mut paths = 0;
for j in 0..input {
paths += recurse(i as usize, j as usize, &array);
}
paths
});
handles.push(handle);
}
let duration = start.elapsed();
for handle in handles {
paths += handle.join().unwrap();
}
println!("Time elapsed is: {:?}", duration);
println!("{}", paths);
}Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 3 1 1 1 1 1 1 1 1 1 |
| correct output |
|---|
| 9 |
| user output |
|---|
| Time elapsed is: 97.319µs 9 |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 3 1 2 3 6 5 4 7 8 9 |
| correct output |
|---|
| 135 |
| user output |
|---|
| Time elapsed is: 95.796µs 135 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 3 7 8 1 4 5 4 3 9 6 |
| correct output |
|---|
| 57 |
| user output |
|---|
| Time elapsed is: 91.346µs 57 |
Test 4
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 10000 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at 'failed to spawn thread: Os { code: 11, kind: WouldBlock, messag...Test 5
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 187458477 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at 'failed to spawn thread: Os { code: 11, kind: WouldBlock, messag...Test 6
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100 2995 8734 1018 2513 7971 5063 ... |
| correct output |
|---|
| 964692694 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at 'failed to spawn thread: Os { code: 11, kind: WouldBlock, messag...Test 7
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 1000000 |
| user output |
|---|
| (empty) |
Test 8
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 1000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 229147081 |
| user output |
|---|
| (empty) |
Test 9
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 1000 520283 805991 492643 75254 527... |
| correct output |
|---|
| 951147313 |
| user output |
|---|
| (empty) |
