結果

問題 No.942 プレゼント配り
ユーザー iqueue02iqueue02
提出日時 2019-12-05 18:36:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 881 bytes
コンパイル時間 1,412 ms
コンパイル使用メモリ 166,780 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-23 11:22:01
合計ジャッジ時間 3,459 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n, k;
  cin >> n >> k;
  if (n == 1 && k == 1) {
    cout << "Yes" << endl;
    cout << 1 << endl;
    return 0;
  }
  if (n & 1) {
    cout << "No" << endl;
    return 0; 
  } else {
    int m = n / k;
    if (m & 1 || k == 1) {
      cout << "No" << endl;
      return 0;
    } else {
      cout << "Yes" << endl;
      vector<int> l(n/2), r(n/2);
      for (int i = 0; i < n/2 ; i++) l[i] = n/2 - i;
      for (int i = 1; i <= n/2; i++) r[i-1] = i + n/2;
      int cnt = 0;
      m /= 2;
      for (int i = 0; i < n/2; i++) {
        cout << l[i] << " " << r[i] << " ";
        cnt++;
        if (cnt == m) {
          cnt = 0;
          cout << endl;
        }
      }
    }
  }
  return 0;
}
0