CSES - Datatähti 2024 alku - Results
Submission details
Task:Lumimyrsky
Sender:joonas_lerber
Submission time:2023-10-31 20:06:57 +0200
Language:Rust
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails

Code

use std::io::{BufRead, BufReader};

fn main() -> std::io::Result<()> {
    let mut input = BufReader::new(std::io::stdin());
    let mut path1_input: String = "".to_owned();
    let mut path2_input: String = "".to_owned();
    input.read_line(&mut path1_input)?;
    input.read_line(&mut path2_input)?;
    let path1: Vec<i32> = path1_input
        .split_whitespace()
        .map(|num| num.parse().unwrap())
        .collect();
    let path2: Vec<i32> = path2_input
        .split_whitespace()
        .map(|num| num.parse().unwrap())
        .collect();

    let mut path1_shifted = path1.clone();
    path1_shifted.rotate_right(1);
    let mut path2_shifted = path2.clone();
    path2_shifted.rotate_right(1);

    let path1_rise: i32 = path1
        .iter()
        .zip(path1_shifted.iter())
        .map(|(a, b)| a - b)
        .skip(1)
        .filter(|x| x > &0)
        .sum();

    let path2_rise: i32 = path2
        .iter()
        .zip(path2_shifted.iter())
        .map(|(a, b)| a - b)
        .skip(1)
        .filter(|x| x > &0)
        .sum();

    dbg!(path1_rise);
    dbg!(path2_rise);
    match path1_rise > path2_rise {
        true => println!("2"),
        false => println!("1"),
    }
    Ok(())
}

Test details

Test 1

Verdict: ACCEPTED

input
0 0 1 1 1 2 2 2 1 0
0 1 2 3 2 2 3 0 1 1

correct output
1

user output
1

Error:
[input/code.rs:39] path1_rise = 2
[input/code.rs:40] path2_rise = 5

Test 2

Verdict: ACCEPTED

input
1 1 1 1 1 1 1 1 0 1
1 0 0 0 1 0 1 0 0 0

correct output
1

user output
1

Error:
[input/code.rs:39] path1_rise = 1
[input/code.rs:40] path2_rise = 2

Test 3

Verdict: ACCEPTED

input
1 2 2 2 0 0 0 2 0 0
0 1 0 1 1 2 1 2 1 2

correct output
1

user output
1

Error:
[input/code.rs:39] path1_rise = 3
[input/code.rs:40] path2_rise = 5

Test 4

Verdict: ACCEPTED

input
4 2 0 10 6 10 4 5 4 3
3 1 2 7 6 1 3 5 2 6

correct output
2

user output
2

Error:
[input/code.rs:39] path1_rise = 15
[input/code.rs:40] path2_rise = 14

Test 5

Verdict: ACCEPTED

input
6 0 7 9 3 1 5 6 9 4
9 0 1 0 2 2 0 1 4 7

correct output
2

user output
2

Error:
[input/code.rs:39] path1_rise = 17
[input/code.rs:40] path2_rise = 10

Test 6

Verdict: ACCEPTED

input
10 9 6 1 10 9 7 6 7 6
2 1 10 2 0 7 2 9 4 6

correct output
1

user output
1

Error:
[input/code.rs:39] path1_rise = 10
[input/code.rs:40] path2_rise = 25

Test 7

Verdict: ACCEPTED

input
22 5 87 83 20 36 92 98 49 9
61 40 77 35 52 49 29 100 18 81

correct output
1

user output
1

Error:
[input/code.rs:39] path1_rise = 160
[input/code.rs:40] path2_rise = 188

Test 8

Verdict: ACCEPTED

input
90 95 33 21 82 6 4 37 10 99
60 10 53 61 42 53 33 48 62 83

correct output
2

user output
2

Error:
[input/code.rs:39] path1_rise = 188
[input/code.rs:40] path2_rise = 112

Test 9

Verdict: ACCEPTED

input
7 22 78 32 44 98 73 46 98 31
54 26 50 8 7 42 27 1 50 53

correct output
2

user output
2

Error:
[input/code.rs:39] path1_rise = 189
[input/code.rs:40] path2_rise = 111

Test 10

Verdict: ACCEPTED

input
88 1 97 24 87 38 53 82 23 42
1 61 43 77 40 40 52 88 48 93

correct output
2

user output
2

Error:
[input/code.rs:39] path1_rise = 222
[input/code.rs:40] path2_rise = 187

Test 11

Verdict: ACCEPTED

input
1 36 50 50 50 0 13 31 14 1
22 88 42 13 25 13 8 39 34 49

correct output
1

user output
1

Error:
[input/code.rs:39] path1_rise = 80
[input/code.rs:40] path2_rise = 124