結果

問題 No.942 プレゼント配り
コンテスト
ユーザー chakku
提出日時 2020-03-31 23:02:24
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 567 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 572 ms
コンパイル使用メモリ 76,720 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-11 21:03:56
合計ジャッジ時間 2,726 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;

// N <= 2 * 10^5

int main(){
    int n,k; cin >> n >> k;
    if(n%k > 0){
        cout << "No" << endl;
        return 0;
    }

    int m = n / k;
    if(m % 2 == 1){
        cout << "No" << endl;
        return 0;
    }

    const int t = m / 2;
    cout << "Yes" << endl;
    for(int i=0;i<k;i++){
        const int s = 1 + t * i;
        for(int j=0;j<t;j++){
            cout << s + j << " ";
        }
        const int e = n - t * i;
        for(int j=0;j<t;j++){
            cout << e - j << endl;
        }
    }
}
0