結果

問題 No.942 プレゼント配り
ユーザー pekempeypekempey
提出日時 2019-12-05 00:16:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 111,684 KB
最終ジャッジ日時 2023-08-21 07:14:36
合計ジャッジ時間 4,285 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,372 KB
testcase_01 AC 127 ms
111,684 KB
testcase_02 AC 69 ms
71,400 KB
testcase_03 AC 69 ms
71,540 KB
testcase_04 AC 113 ms
90,568 KB
testcase_05 AC 116 ms
98,196 KB
testcase_06 AC 67 ms
71,368 KB
testcase_07 AC 67 ms
71,236 KB
testcase_08 AC 109 ms
87,132 KB
testcase_09 AC 115 ms
88,676 KB
testcase_10 AC 69 ms
71,024 KB
testcase_11 AC 69 ms
71,016 KB
testcase_12 AC 69 ms
71,240 KB
testcase_13 AC 68 ms
71,036 KB
testcase_14 WA -
testcase_15 AC 97 ms
77,364 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 70 ms
71,252 KB
testcase_19 AC 69 ms
71,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

N, K = map(int, input().split())

if N * (N + 1) // 2 % K != 0:
  print('No')
  sys.exit()



if N // K % 2 == 1 and (N // K) % K == 0:
  print('Yes')
  for i in range(K):
    a = []
    for j in range(N // K):
      a.append(K * j + (i + j) % K + 1)
    print(*a)
elif N // K % 2 == 0:
  print('Yes')
  a = []
  for i in range(N // 2):
    a.append(i)
    a.append(N - 1 - i)
  for i in range(K):
    b = []
    for j in range(N // K):
      b.append(a[i * N // K + j] + 1)
    print(*b)
else:
  print('No')
0