結果

問題 No.942 プレゼント配り
ユーザー eSeF
提出日時 2019-12-05 01:44:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 1,833 ms
コンパイル使用メモリ 193,972 KB
最終ジャッジ日時 2025-01-08 08:37:02
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD (int)1e9+7
#define EPS 1e-8
#define INF 1e9+10
#define INFL 1e18
typedef long long ll;
using namespace std;
int main()
{
  ll N,K;
  cin >> N >> K;
  ll sum=N*(N+1)/2;
  if(sum%K==0&&N%(2*K)==0){
      cout << "Yes" << endl;
      int num = N/(2*K);
      rep(i,K){
          for(int j=1;j<=num;j++){
              cout << i*num+j << " " << N+1-(i*num)-j << " ";
          }
          cout << endl;
      }
  }
  else{
      cout << "No" << endl;
  }
}
0