提出 #15798375


ソースコード 拡げる

use proconio::input;

fn main() {
    input! {
        h: usize,
        w: usize,
        mut a: [[u8; w]; h],
    };
    let mut o = vec![];
    for i in 0..h {
        for j in 0..w {
            if a[i][j] % 2 != 0 {
                if j + 1 < w && a[i][j + 1] % 2 != 0 {
                    a[i][j] -= 1;
                    a[i][j + 1] += 1;
                    o.push((i, j, i, j + 1));
                } else if i + 1 < h && a[i + 1][j] % 2 != 0 {
                    a[i][j] -= 1;
                    a[i + 1][j] += 1;
                    o.push((i, j, i + 1, j));
                } else {
                    if j + 1 < w {
                        a[i][j] -= 1;
                        a[i][j + 1] += 1;
                        o.push((i, j, i, j + 1));
                    } else if i + 1 < h {
                        a[i][j] -= 1;
                        a[i + 1][j] += 1;
                        o.push((i, j, i + 1, j));
                    }
                }
            }
        }
    }
    println!("{}", o.len());
    for (y_i, x_i, y_j, x_j) in o.iter() {
        println!("{} {} {} {}", y_i + 1, x_i + 1, y_j + 1, x_j + 1);
    }
}

提出情報

提出日時
問題 D - Make Them Even
ユーザ bouzuya
言語 Rust (1.42.0)
得点 400
コード長 1155 Byte
結果 AC
実行時間 210 ms
メモリ 7008 KiB

ジャッジ結果

セット名 All Sample
得点 / 配点 400 / 400 0 / 0
結果
AC × 29
AC × 3
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
hand_1 AC 6 ms 2160 KiB
hand_2 AC 1 ms 2040 KiB
hand_3 AC 2 ms 2172 KiB
hand_4 AC 2 ms 2056 KiB
hand_5 AC 210 ms 7008 KiB
hand_6 AC 12 ms 2868 KiB
max_1 AC 156 ms 5400 KiB
max_10 AC 155 ms 5392 KiB
max_2 AC 155 ms 5488 KiB
max_3 AC 157 ms 5488 KiB
max_4 AC 155 ms 5400 KiB
max_5 AC 159 ms 5488 KiB
max_6 AC 155 ms 5456 KiB
max_7 AC 156 ms 5412 KiB
max_8 AC 157 ms 5456 KiB
max_9 AC 161 ms 5452 KiB
random_1 AC 6 ms 1992 KiB
random_10 AC 35 ms 2516 KiB
random_2 AC 42 ms 2924 KiB
random_3 AC 58 ms 3116 KiB
random_4 AC 23 ms 2512 KiB
random_5 AC 41 ms 2448 KiB
random_6 AC 71 ms 3488 KiB
random_7 AC 54 ms 2888 KiB
random_8 AC 67 ms 3264 KiB
random_9 AC 94 ms 3796 KiB
sample_01 AC 5 ms 2048 KiB
sample_02 AC 1 ms 2036 KiB
sample_03 AC 3 ms 2040 KiB