結果

問題 No.942 プレゼント配り
ユーザー vwxyzvwxyz
提出日時 2023-07-17 10:33:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,153 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 12,132 KB
実行使用メモリ 18,320 KB
最終ジャッジ日時 2023-10-18 00:18:22
合計ジャッジ時間 4,069 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 AC 38 ms
11,308 KB
testcase_03 AC 39 ms
11,308 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 37 ms
11,308 KB
testcase_07 AC 38 ms
11,308 KB
testcase_08 AC 130 ms
17,504 KB
testcase_09 AC 144 ms
18,320 KB
testcase_10 AC 38 ms
11,308 KB
testcase_11 AC 38 ms
11,308 KB
testcase_12 AC 38 ms
11,308 KB
testcase_13 AC 39 ms
11,308 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 38 ms
11,308 KB
testcase_19 AC 38 ms
11,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write

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

if K%2==0 and N//K%2 or N==K:
    print("No")
    exit()
def solve(N,K):
    if N==0:
        return [[] for k in range(K)]
    if N==3:
        return [[k,(K//2+k)%K+K,(K-1-2*k)%K+2*K] for k in range(K)]
    lst=solve(N-K*2,K)
    for i in range(N-K*2,N-K):
        lst[i-(N-K*2)].append(i)
    for i in range(N-K,N):
        lst[N-1-i].append(i)
    return lst

print("Yes")
for lst in solve(N,K):
    print(*[x+1 for x in lst])
0