結果

問題 No.942 プレゼント配り
ユーザー MayimgMayimg
提出日時 2020-07-26 14:47:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 828 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 203,096 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-11 01:05:13
合計ジャッジ時間 4,636 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, k;
  cin >> n >> k;
  if (k == 1) {
    for (int i = 1; i <= n; i++) {
      if (i > 1) cout << " ";
      cout << i;
    }
    cout << '\n';
  }
  if (n % 2 != 0) {
    cout << "No\n";
    return 0;
  } else if (n == 1) {
    cout << 1 << '\n';
    return 0;
  }
  if ((n / k) % 2 != 0) {
    cout << "No\n";
    return 0;
  }
  int t = n / k / 2;
  vector<pair<int, int>> p;
  for (int i = 0; i < n / 2; i++) {
    p.emplace_back(i, n - 1 - i);
  }
  cout << "Yes\n";
  int c = 0;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < t; j++) {
      if (j > 0) cout << " ";
      cout << p[c].first + 1 << " " << p[c].second + 1;
      c++;
    }
    cout << '\n';
  }
  return 0;
}
0