結果

問題 No.115 遠足のおやつ
ユーザー tcltktcltk
提出日時 2021-01-17 02:35:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 482 ms / 5,000 ms
コード長 1,314 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 159,416 KB
最終ジャッジ日時 2023-08-31 01:02:07
合計ジャッジ時間 14,692 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 234 ms
82,968 KB
testcase_01 AC 271 ms
88,024 KB
testcase_02 AC 260 ms
86,912 KB
testcase_03 AC 245 ms
83,512 KB
testcase_04 AC 379 ms
121,624 KB
testcase_05 AC 239 ms
82,900 KB
testcase_06 AC 238 ms
82,904 KB
testcase_07 AC 263 ms
86,576 KB
testcase_08 AC 255 ms
86,896 KB
testcase_09 AC 269 ms
89,880 KB
testcase_10 AC 271 ms
90,912 KB
testcase_11 AC 248 ms
83,888 KB
testcase_12 AC 257 ms
86,784 KB
testcase_13 AC 242 ms
82,904 KB
testcase_14 AC 265 ms
87,184 KB
testcase_15 AC 327 ms
102,704 KB
testcase_16 AC 356 ms
111,964 KB
testcase_17 AC 288 ms
92,692 KB
testcase_18 AC 241 ms
83,828 KB
testcase_19 AC 266 ms
88,136 KB
testcase_20 AC 267 ms
87,244 KB
testcase_21 AC 256 ms
87,216 KB
testcase_22 AC 293 ms
93,488 KB
testcase_23 AC 268 ms
87,636 KB
testcase_24 AC 293 ms
93,464 KB
testcase_25 AC 296 ms
92,656 KB
testcase_26 AC 280 ms
87,716 KB
testcase_27 AC 276 ms
88,248 KB
testcase_28 AC 272 ms
87,824 KB
testcase_29 AC 283 ms
87,580 KB
testcase_30 AC 295 ms
93,852 KB
testcase_31 AC 273 ms
87,260 KB
testcase_32 AC 331 ms
102,364 KB
testcase_33 AC 267 ms
87,068 KB
testcase_34 AC 364 ms
112,472 KB
testcase_35 AC 288 ms
91,920 KB
testcase_36 AC 287 ms
93,572 KB
testcase_37 AC 330 ms
102,068 KB
testcase_38 AC 482 ms
159,416 KB
testcase_39 AC 482 ms
158,960 KB
testcase_40 AC 240 ms
82,896 KB
testcase_41 AC 236 ms
83,132 KB
testcase_42 AC 237 ms
82,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """30 40 4
# """
# sys.stdin = io.StringIO(_INPUT)


def main():
    N, D, K = map(int, input().split())

    dp = [[[list() for _ in range(K+1)] for _ in range(D+1)] for _ in range(N+1)]
    dp[0][0][0] = [0]
    for n in range(0, N):
        for d in range(0, D+1):
            for k in range(0, K+1):
                if dp[n][d][k]:
                    if d + (n+1) <= D and k + 1 <= K:
                        if dp[n+1][d+(n+1)][k+1]:
                            dp[n+1][d+(n+1)][k+1] = min(dp[n+1][d+(n+1)][k+1], dp[n][d][k] + [n+1])
                        else:
                            dp[n+1][d+(n+1)][k+1] = dp[n][d][k] + [n+1]
                    if dp[n+1][d][k]:
                        dp[n+1][d][k] = min(dp[n+1][d][k], dp[n][d][k])
                    else:
                        dp[n+1][d][k] = dp[n][d][k]

    if dp[N][D][K]:
        print(*dp[N][D][K][1:])
    else:
        print(-1)


if __name__ == '__main__':
    main()
0