結果

問題 No.942 プレゼント配り
ユーザー polylogKpolylogK
提出日時 2019-12-05 00:04:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 1,652 ms
コンパイル使用メモリ 171,284 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-08 12:23:05
合計ジャッジ時間 3,635 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, k; scanf("%d%d", &n, &k);

	if((n / k) & 1) {
		printf("No\n");
		return 0;
	}

	std::vector<std::vector<int>> ans(k);
	for(int i = 1; i <= n;) {
		for(int j = 0; j < k; j++) ans[j].push_back(i++);
		for(int j = 0; j < k; j++) ans[k - j - 1].push_back(i++);
	}

	printf("Yes\n");
	for(auto v: ans) {
		for(auto e: v) printf("%d ", e);
		printf("\n");
	}
	return 0;
}
0