結果

問題 No.942 プレゼント配り
ユーザー hiro71687k
提出日時 2023-06-04 18:04:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 3,991 ms
コンパイル使用メモリ 251,528 KB
最終ジャッジ日時 2025-02-13 22:40:56
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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