結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,348 KB
testcase_01 AC 130 ms
111,672 KB
testcase_02 AC 73 ms
71,544 KB
testcase_03 AC 70 ms
71,368 KB
testcase_04 AC 115 ms
90,608 KB
testcase_05 AC 118 ms
98,308 KB
testcase_06 WA -
testcase_07 AC 69 ms
71,156 KB
testcase_08 AC 111 ms
87,092 KB
testcase_09 AC 118 ms
88,852 KB
testcase_10 AC 71 ms
71,364 KB
testcase_11 AC 71 ms
71,144 KB
testcase_12 AC 71 ms
71,492 KB
testcase_13 AC 71 ms
71,648 KB
testcase_14 WA -
testcase_15 AC 99 ms
77,360 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 70 ms
71,328 KB
testcase_19 AC 69 ms
71,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

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

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

print('Yes')

if N // K % 2 == 1:
  for i in range(K):
    a = []
    for j in range(N // K):
      a.append(K * j + (i + j) % K + 1)
    print(*a)
else:
  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)
0