結果

問題 No.1528 Not 1
ユーザー phsplsphspls
提出日時 2022-11-02 20:56:33
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 1,997 ms
コンパイル使用メモリ 149,128 KB
実行使用メモリ 8,616 KB
最終ジャッジ日時 2023-09-24 08:41:14
合計ジャッジ時間 4,732 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 12 ms
7,176 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 12 ms
7,612 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 7 ms
5,280 KB
testcase_07 AC 11 ms
7,164 KB
testcase_08 AC 6 ms
4,668 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 6 ms
4,528 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 13 ms
7,992 KB
testcase_19 AC 14 ms
8,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();

    if n % 2 == 0 {
        println!("{}", (1..=n/2).map(|i| (2*i).to_string()).collect::<Vec<_>>().join(" "));
        return;
    }
    if n < 6 {
        println!("-1");
        return;
    }
    let mut result = vec![2, 4];
    for i in 4..=n/2 {
        result.push(i*2);
    }
    result.push(6);
    result.push(3);
    println!("{}", result.iter().map(|&v| v.to_string()).collect::<Vec<_>>().join(" "));
}
0