結果

問題 No.115 遠足のおやつ
ユーザー lloyzlloyz
提出日時 2023-07-02 16:02:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 5,000 ms
コード長 625 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 85,896 KB
最終ジャッジ日時 2023-09-23 12:09:26
合計ジャッジ時間 5,848 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,388 KB
testcase_01 AC 75 ms
76,004 KB
testcase_02 AC 74 ms
76,280 KB
testcase_03 AC 71 ms
75,792 KB
testcase_04 AC 86 ms
76,652 KB
testcase_05 AC 65 ms
71,220 KB
testcase_06 AC 67 ms
71,536 KB
testcase_07 AC 73 ms
76,016 KB
testcase_08 AC 74 ms
76,064 KB
testcase_09 AC 78 ms
76,032 KB
testcase_10 AC 77 ms
76,056 KB
testcase_11 AC 70 ms
75,860 KB
testcase_12 AC 74 ms
76,108 KB
testcase_13 AC 66 ms
71,484 KB
testcase_14 AC 73 ms
76,176 KB
testcase_15 AC 82 ms
76,516 KB
testcase_16 AC 89 ms
76,584 KB
testcase_17 AC 82 ms
76,604 KB
testcase_18 AC 71 ms
76,456 KB
testcase_19 AC 77 ms
76,340 KB
testcase_20 AC 74 ms
76,592 KB
testcase_21 AC 71 ms
76,136 KB
testcase_22 AC 83 ms
76,360 KB
testcase_23 AC 73 ms
76,140 KB
testcase_24 AC 79 ms
76,728 KB
testcase_25 AC 83 ms
76,708 KB
testcase_26 AC 77 ms
76,544 KB
testcase_27 AC 79 ms
76,244 KB
testcase_28 AC 78 ms
76,476 KB
testcase_29 AC 78 ms
76,724 KB
testcase_30 AC 78 ms
76,432 KB
testcase_31 AC 78 ms
76,584 KB
testcase_32 AC 80 ms
76,396 KB
testcase_33 AC 76 ms
76,420 KB
testcase_34 AC 82 ms
76,512 KB
testcase_35 AC 78 ms
76,456 KB
testcase_36 AC 77 ms
76,404 KB
testcase_37 AC 85 ms
76,568 KB
testcase_38 AC 107 ms
85,836 KB
testcase_39 AC 107 ms
85,896 KB
testcase_40 AC 64 ms
71,396 KB
testcase_41 AC 64 ms
71,308 KB
testcase_42 AC 66 ms
71,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d, k = map(int, input().split())

DP = [[[False for _ in range(d + 1)] for _ in range(k + 1)] for _ in range(n + 1)]
DP[0][0][0] = True
for i in range(n):
    for x in range(k + 1):
        for j in range(d + 1):
            if DP[i][x][j]:
                DP[i + 1][x][j] = True
                if x + 1 <= k and i + j + 1 <= d:
                    DP[i + 1][x + 1][i + j + 1] = True

if not DP[n][k][d]:
    print(-1)
    exit()

ANS = []
cc = d
num = k - 1
for i in range(n, 0, -1):
    if cc - i < 0:
        continue
    if DP[i][num][cc - i]:
        ANS.append(i)
        cc -= i
        num -= 1
print(*ANS[::-1])
0