結果

問題 No.942 プレゼント配り
ユーザー chakku
提出日時 2020-04-01 00:35:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 595 bytes
コンパイル時間 1,507 ms
コンパイル使用メモリ 167,348 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 14:46:51
合計ジャッジ時間 6,859 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 1
other AC * 5 RE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
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){
        assert(false);
        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