結果

問題 No.942 プレゼント配り
ユーザー hiro71687khiro71687k
提出日時 2023-06-04 18:04:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 6,847 ms
コンパイル使用メモリ 259,048 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 08:18:37
合計ジャッジ時間 6,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=2000000000000000000;
ll mod=998244353;
int main(){
    ll n,k;
    cin >> n >> k;
    if (n==1)
    {
        cout << "Yes" << endl;
        cout << 1 << endl;
        return 0;
    }
    if (k==1)
    {
        cout << "Yes" << endl;
        for (ll i = 0; i < n; i++)
        {
            cout << i+1 << ' ';
        }
        cout << endl;
        return  0;
    }
    
    if ((n/k)%2)
    {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for (ll i = 0; i < k; i++)
    {
        for (ll j = 0; j < n/(k*2); j++)
        {
            cout << i*(n/(k*2))+j+1 << ' '<< n-(i*(n/(k*2))+j) << ' ';
        }
        cout << endl;
    }
}
0