結果

問題 No.942 プレゼント配り
ユーザー chakkuchakku
提出日時 2020-04-01 00:35:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 595 bytes
コンパイル時間 1,390 ms
コンパイル使用メモリ 165,436 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 21:06:56
合計ジャッジ時間 6,859 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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