Submission details
Task:Maalaus
Sender:Jaksu
Submission time:2025-10-28 18:47:04 +0200
Language:Rust (2021)
Status:COMPILE ERROR

Compiler report

error[E0308]: mismatched types
  --> input/code.rs:34:38
   |
34 |             rowvector[colordata.2] = true;
   |             ----------------------   ^^^^ expected `isize`, found `bool`
   |             |
   |             expected due to the type of this binding

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.

Code

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Failed to read input");

    let data: Vec<usize> = parse_data(&input);

    // Row- and colvectors contain true or false for each index depening on whether that color has filled that row/column

    let mut rowvector: Vec<isize> = vec!();
    let mut colvector: Vec<isize> = vec!();
    let mut colorvector: Vec<usize> = vec!();

    for _i in 0..data[0] {
        rowvector.push(-1);
    }

    for _i in 0..data[1] {
        colvector.push(-1);
    }

    for _i in 0..data[2] {
        colorvector.push(0);
    }

    for _i in 0..data[3] {
        input.clear();
        io::stdin().read_line(&mut input).expect("Failed to read input");

        let colordata = parse_input(&input);

        if colordata.0 {
            rowvector[colordata.2] = true;

            for _i in 0..data[1] {

            }
        }
    }
}

pub fn parse_data(input: &String) -> Vec<usize> {
    let datavector = input.split_ascii_whitespace().map(|e| e.parse::<usize>().unwrap()).collect();
    return datavector
}

pub fn parse_input(input: &String) -> (bool, usize, usize) {
    let datavector: Vec<&str> = input.split_ascii_whitespace().collect();
    let command = match datavector[0] {
        "R" => true,
        "C" => false,
        _ => false,
    };

    let index = datavector[1].parse::<usize>().unwrap();
    let color = datavector[2].parse::<usize>().unwrap();

    return (command, index, color);
}