結果

問題 No.942 プレゼント配り
ユーザー 特命ログイン特命ログイン
提出日時 2019-12-06 04:03:20
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 894 bytes
コンパイル時間 1,035 ms
コンパイル使用メモリ 136,980 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 19:39:28
合計ジャッジ時間 3,855 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 27 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 19 ms
4,376 KB
testcase_05 AC 27 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 14 ms
4,380 KB
testcase_09 AC 16 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{Read, stdin};

fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    let mut tok = buf.split_whitespace();
    let mut get = || tok.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
     }
     
     let n = get!();
     let k = get!();
     
     if k == 1 {
         println!("Yes");
         for i in 1..=n {
             if i > 1 { print!(" "); }
             print!("{}", i);
         }
         println!();
         return;
     }
     
     let r = n / k;
     if r % 2 != 0 {
         println!("No");
         return;
     }
     
     println!("Yes");
     for i in 0..k {
         for j in 0..r / 2 {
             if j > 0 { print!(" "); }
             let e = j + i * r / 2;
             print!("{} {}", e + 1, n - e);
         }
         println!();
     }
}
0