Submission #31636456


Source Code Expand

use proconio::input;

fn main() {
    input! {
        h: usize,
        w: usize,
        mut a: [[usize; w]; h],
    };
    for i in 0..h {
        for j in 0..w {
            a[i][j] %= 2;
        }
    }

    let mut ops = vec![];
    for i in 0..h {
        for j in 0..w {
            if a[i][j] == 0 {
                continue;
            }

            if j + 1 < w {
                a[i][j + 1] = if a[i][j + 1] == 1 { 0 } else { 1 };
                ops.push((i + 1, j + 1, i + 1, j + 2));
                continue;
            }

            if i + 1 < h {
                a[i + 1][j] = if a[i + 1][j] == 1 { 0 } else { 1 };
                ops.push((i + 1, j + 1, i + 2, j + 1));
                continue;
            }
        }
    }

    println!("{}", ops.len());
    for (y1, x1, y2, x2) in ops {
        println!("{} {} {} {}", y1, x1, y2, x2);
    }
}

Submission Info

Submission Time
Task D - Make Them Even
User bouzuya
Language Rust (1.42.0)
Score 400
Code Size 872 Byte
Status AC
Exec Time 236 ms
Memory 8828 KiB

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
AC × 29
AC × 3
Set Name Test Cases
All hand_1, hand_2, hand_3, hand_4, hand_5, hand_6, max_1, max_10, max_2, max_3, max_4, max_5, max_6, max_7, max_8, max_9, random_1, random_10, random_2, random_3, random_4, random_5, random_6, random_7, random_8, random_9, sample_01, sample_02, sample_03
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_1 AC 7 ms 2052 KiB
hand_2 AC 2 ms 2044 KiB
hand_3 AC 2 ms 2140 KiB
hand_4 AC 2 ms 2220 KiB
hand_5 AC 233 ms 8728 KiB
hand_6 AC 13 ms 4516 KiB
max_1 AC 230 ms 8756 KiB
max_10 AC 231 ms 8708 KiB
max_2 AC 235 ms 8712 KiB
max_3 AC 233 ms 8716 KiB
max_4 AC 236 ms 8720 KiB
max_5 AC 232 ms 8740 KiB
max_6 AC 231 ms 8716 KiB
max_7 AC 236 ms 8828 KiB
max_8 AC 235 ms 8716 KiB
max_9 AC 230 ms 8708 KiB
random_1 AC 11 ms 2016 KiB
random_10 AC 39 ms 2696 KiB
random_2 AC 60 ms 3420 KiB
random_3 AC 80 ms 3952 KiB
random_4 AC 34 ms 2632 KiB
random_5 AC 49 ms 3156 KiB
random_6 AC 95 ms 4488 KiB
random_7 AC 74 ms 3852 KiB
random_8 AC 93 ms 4328 KiB
random_9 AC 133 ms 5624 KiB
sample_01 AC 6 ms 2080 KiB
sample_02 AC 2 ms 2144 KiB
sample_03 AC 2 ms 2036 KiB