結果

問題 No.625 ソンタクロース
ユーザー mkawa2mkawa2
提出日時 2020-06-11 12:54:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 306 ms / 4,000 ms
コード長 1,303 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 11,016 KB
実行使用メモリ 9,000 KB
最終ジャッジ日時 2023-09-06 08:09:12
合計ジャッジ時間 3,774 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,840 KB
testcase_01 AC 20 ms
8,644 KB
testcase_02 AC 20 ms
8,648 KB
testcase_03 AC 20 ms
8,780 KB
testcase_04 AC 20 ms
8,836 KB
testcase_05 AC 19 ms
8,712 KB
testcase_06 AC 20 ms
8,680 KB
testcase_07 AC 20 ms
8,836 KB
testcase_08 AC 20 ms
8,740 KB
testcase_09 AC 20 ms
8,672 KB
testcase_10 AC 20 ms
8,688 KB
testcase_11 AC 20 ms
8,720 KB
testcase_12 AC 20 ms
8,836 KB
testcase_13 AC 20 ms
8,776 KB
testcase_14 AC 20 ms
8,776 KB
testcase_15 AC 41 ms
8,812 KB
testcase_16 AC 28 ms
8,696 KB
testcase_17 AC 134 ms
8,852 KB
testcase_18 AC 306 ms
8,924 KB
testcase_19 AC 58 ms
8,872 KB
testcase_20 AC 59 ms
8,804 KB
testcase_21 AC 40 ms
8,736 KB
testcase_22 AC 248 ms
9,000 KB
testcase_23 AC 33 ms
8,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]


def main():
    n,m=MI()
    if n==1:print(m)
    if n==2:print(-1,m)
    if n==3:print(m,0,0)
    if n<4:exit()
    ans=[0]*n
    ans[-3]=m
    for i in range(n-4,-1,-1):
        #print(i,ans)
        hp=[]
        p=m
        for j in range(i+1,n):heappush(hp,(ans[j],-j))
        nans = [0] * n
        for _ in range((n-i)//2):
            a,j=heappop(hp)
            j=-j
            nans[j]=a+1
            p-=a+1
        if p<0:
            for j in range(i+1):
                ans[j]=-1
            break
        nans[i]=p
        ans=nans

    print(*ans)

main()
0