結果

問題 No.115 遠足のおやつ
ユーザー TawaraTawara
提出日時 2015-09-16 01:55:41
言語 Python2
(2.7.18)
結果
AC  
実行時間 345 ms / 5,000 ms
コード長 409 bytes
コンパイル時間 730 ms
コンパイル使用メモリ 6,676 KB
実行使用メモリ 6,136 KB
最終ジャッジ日時 2023-08-31 00:35:41
合計ジャッジ時間 4,852 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,096 KB
testcase_01 AC 10 ms
5,848 KB
testcase_02 AC 14 ms
5,852 KB
testcase_03 AC 10 ms
5,928 KB
testcase_04 AC 207 ms
6,136 KB
testcase_05 AC 9 ms
5,952 KB
testcase_06 AC 10 ms
6,020 KB
testcase_07 AC 11 ms
5,840 KB
testcase_08 AC 9 ms
5,988 KB
testcase_09 AC 10 ms
5,916 KB
testcase_10 AC 9 ms
6,044 KB
testcase_11 AC 10 ms
5,860 KB
testcase_12 AC 9 ms
5,976 KB
testcase_13 AC 10 ms
5,992 KB
testcase_14 AC 16 ms
5,928 KB
testcase_15 AC 116 ms
6,092 KB
testcase_16 AC 182 ms
5,964 KB
testcase_17 AC 71 ms
5,872 KB
testcase_18 AC 10 ms
5,920 KB
testcase_19 AC 23 ms
6,052 KB
testcase_20 AC 17 ms
5,856 KB
testcase_21 AC 9 ms
5,924 KB
testcase_22 AC 73 ms
5,920 KB
testcase_23 AC 14 ms
6,092 KB
testcase_24 AC 65 ms
5,896 KB
testcase_25 AC 77 ms
5,920 KB
testcase_26 AC 26 ms
6,036 KB
testcase_27 AC 38 ms
5,940 KB
testcase_28 AC 25 ms
6,056 KB
testcase_29 AC 38 ms
6,000 KB
testcase_30 AC 66 ms
6,000 KB
testcase_31 AC 26 ms
5,936 KB
testcase_32 AC 134 ms
6,060 KB
testcase_33 AC 15 ms
6,036 KB
testcase_34 AC 200 ms
6,136 KB
testcase_35 AC 50 ms
5,868 KB
testcase_36 AC 55 ms
5,908 KB
testcase_37 AC 141 ms
5,908 KB
testcase_38 AC 344 ms
5,992 KB
testcase_39 AC 345 ms
6,008 KB
testcase_40 AC 9 ms
5,948 KB
testcase_41 AC 10 ms
6,044 KB
testcase_42 AC 10 ms
5,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D,K = map(int,raw_input().split())
dp = [None]*(D+1+N)
dp[0] = []
for i in xrange(K):
	for j in reversed(xrange(D)):
		if dp[j] == None:
			continue
		for k in xrange(1,N+1):
			if k in dp[j]:
				continue
			tmpv = dp[j] + [k]
			if dp[j+k] is None or not (len(tmpv) <= len(dp[j+k]) and tmpv >= dp[j+k]):
				dp[j+k] = tmpv
print -1 if dp[D] == None or len(dp[D]) != K else " ".join(map(str,sorted(dp[D])))
0