結果

問題 No.115 遠足のおやつ
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-10 20:27:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 81,240 KB
最終ジャッジ日時 2023-09-25 18:17:23
合計ジャッジ時間 6,496 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,088 KB
testcase_01 AC 76 ms
75,896 KB
testcase_02 AC 91 ms
76,268 KB
testcase_03 AC 76 ms
75,892 KB
testcase_04 AC 158 ms
78,500 KB
testcase_05 AC 70 ms
71,220 KB
testcase_06 AC 70 ms
71,236 KB
testcase_07 AC 84 ms
76,352 KB
testcase_08 AC 76 ms
76,184 KB
testcase_09 AC 78 ms
75,908 KB
testcase_10 AC 76 ms
75,900 KB
testcase_11 AC 74 ms
75,684 KB
testcase_12 AC 76 ms
76,044 KB
testcase_13 AC 70 ms
71,328 KB
testcase_14 AC 92 ms
76,616 KB
testcase_15 AC 127 ms
77,628 KB
testcase_16 AC 141 ms
78,500 KB
testcase_17 AC 107 ms
77,564 KB
testcase_18 AC 73 ms
75,736 KB
testcase_19 AC 88 ms
76,640 KB
testcase_20 AC 92 ms
76,592 KB
testcase_21 AC 77 ms
75,948 KB
testcase_22 AC 115 ms
77,392 KB
testcase_23 AC 87 ms
76,592 KB
testcase_24 AC 114 ms
77,068 KB
testcase_25 AC 110 ms
77,556 KB
testcase_26 AC 98 ms
77,076 KB
testcase_27 AC 106 ms
77,172 KB
testcase_28 AC 99 ms
77,108 KB
testcase_29 AC 98 ms
77,144 KB
testcase_30 AC 113 ms
77,396 KB
testcase_31 AC 90 ms
76,652 KB
testcase_32 AC 133 ms
77,976 KB
testcase_33 AC 88 ms
76,488 KB
testcase_34 AC 154 ms
78,476 KB
testcase_35 AC 102 ms
77,252 KB
testcase_36 AC 111 ms
77,504 KB
testcase_37 AC 135 ms
77,876 KB
testcase_38 AC 186 ms
81,240 KB
testcase_39 AC 184 ms
81,140 KB
testcase_40 AC 69 ms
71,252 KB
testcase_41 AC 73 ms
71,364 KB
testcase_42 AC 69 ms
71,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d, k = map(int, input().split())
dp = [[-1]*(d+1) for i in range(k+1)]
dp[0][0] = tuple([])
for i in range(1, n+1):
    for j in reversed(range(k+1)):
        for l in reversed(range(d+1)):
            if dp[j][l] == -1:
                continue
            if j+1 <= k and l+i <= d:
                nt = list(dp[j][l])+[i]
                nt = tuple(nt)
                if dp[j+1][l+i] != -1:
                    dp[j+1][l+i] = min(dp[j+1][l+i], nt)
                else:
                    dp[j+1][l+i] = nt
if dp[k][d] != -1:
    print(*dp[k][d])
else:
    print(-1)
0