結果

問題 No.115 遠足のおやつ
ユーザー vwxyzvwxyz
提出日時 2022-10-18 11:06:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 30,428 KB
最終ジャッジ日時 2023-09-11 05:48:25
合計ジャッジ時間 10,764 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
29,352 KB
testcase_01 AC 136 ms
29,300 KB
testcase_02 AC 139 ms
29,464 KB
testcase_03 AC 136 ms
29,396 KB
testcase_04 AC 139 ms
29,624 KB
testcase_05 AC 137 ms
29,480 KB
testcase_06 AC 138 ms
29,508 KB
testcase_07 AC 138 ms
29,504 KB
testcase_08 AC 137 ms
29,560 KB
testcase_09 AC 137 ms
29,472 KB
testcase_10 AC 138 ms
29,584 KB
testcase_11 AC 135 ms
29,464 KB
testcase_12 AC 138 ms
29,484 KB
testcase_13 AC 138 ms
29,412 KB
testcase_14 AC 141 ms
29,408 KB
testcase_15 AC 141 ms
29,644 KB
testcase_16 AC 141 ms
29,464 KB
testcase_17 AC 138 ms
29,588 KB
testcase_18 AC 140 ms
29,512 KB
testcase_19 AC 141 ms
29,316 KB
testcase_20 AC 140 ms
29,404 KB
testcase_21 AC 139 ms
29,416 KB
testcase_22 AC 138 ms
29,616 KB
testcase_23 AC 140 ms
29,396 KB
testcase_24 AC 140 ms
29,500 KB
testcase_25 AC 140 ms
29,528 KB
testcase_26 AC 138 ms
29,408 KB
testcase_27 AC 139 ms
29,396 KB
testcase_28 AC 139 ms
29,500 KB
testcase_29 AC 138 ms
29,424 KB
testcase_30 AC 140 ms
29,580 KB
testcase_31 AC 141 ms
29,404 KB
testcase_32 AC 140 ms
29,628 KB
testcase_33 AC 140 ms
29,348 KB
testcase_34 AC 140 ms
29,680 KB
testcase_35 AC 138 ms
29,516 KB
testcase_36 AC 138 ms
29,436 KB
testcase_37 AC 138 ms
29,744 KB
testcase_38 AC 141 ms
30,124 KB
testcase_39 AC 139 ms
30,428 KB
testcase_40 AC 138 ms
29,396 KB
testcase_41 AC 139 ms
29,304 KB
testcase_42 AC 138 ms
29,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,D,K=map(int,readline().split())
N=min(N,D)
import numpy as np
dp=np.full((N+1,K+1,D+1),False,dtype=bool)
dp[0][0][0]=True
for n in range(N,0,-1):
    dp[N-n+1]|=dp[N-n]
    dp[N-n+1,1:,n:]|=dp[N-n,:-1,:-n]
ans_lst=[]
for n in range(1,N+1):
    if K and D>=n and dp[N-n,K-1,D-n]:
        ans_lst.append(n)
        D-=n
        K-=1
if K:
    ans_lst=[-1]
print(*ans_lst)
0