結果

問題 No.942 プレゼント配り
ユーザー 特命ログイン
提出日時 2019-12-06 04:03:20
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 894 bytes
コンパイル時間 16,927 ms
コンパイル使用メモリ 378,780 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 04:53:36
合計ジャッジ時間 16,635 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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