結果

問題 No.942 プレゼント配り
ユーザー eSeFeSeF
提出日時 2019-12-05 01:28:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 553 bytes
コンパイル時間 1,828 ms
コンパイル使用メモリ 198,624 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 11:49:01
合計ジャッジ時間 4,230 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 22 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 22 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 16 ms
4,376 KB
testcase_09 AC 19 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,380 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 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

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;
      for(int i=1;i<=K;i++){
          for(int j=0;j<N/(2*K);j++){
              cout << j*K+i << " " << N+1-(j*K+i);
              if(j!=N/(2*K)-1){cout << " ";}
          }
          cout << endl;
      }
  }
  else{
      cout << "No" << endl;
  }
}
0