結果

問題 No.115 遠足のおやつ
ユーザー tookunn_1213tookunn_1213
提出日時 2017-09-24 20:44:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,087 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 17,876 KB
最終ジャッジ日時 2023-08-31 00:45:26
合計ジャッジ時間 4,592 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,908 KB
testcase_01 AC 16 ms
8,592 KB
testcase_02 AC 15 ms
8,340 KB
testcase_03 AC 13 ms
8,180 KB
testcase_04 AC 82 ms
11,556 KB
testcase_05 AC 14 ms
7,852 KB
testcase_06 AC 13 ms
7,812 KB
testcase_07 AC 14 ms
8,216 KB
testcase_08 AC 14 ms
8,420 KB
testcase_09 AC 16 ms
8,716 KB
testcase_10 AC 15 ms
8,872 KB
testcase_11 AC 13 ms
8,204 KB
testcase_12 AC 13 ms
8,276 KB
testcase_13 AC 12 ms
7,848 KB
testcase_14 AC 14 ms
8,296 KB
testcase_15 AC 51 ms
10,064 KB
testcase_16 AC 46 ms
10,776 KB
testcase_17 AC 17 ms
9,004 KB
testcase_18 AC 13 ms
8,328 KB
testcase_19 AC 14 ms
8,412 KB
testcase_20 AC 13 ms
8,336 KB
testcase_21 AC 14 ms
8,244 KB
testcase_22 AC 63 ms
9,800 KB
testcase_23 AC 16 ms
8,476 KB
testcase_24 AC 63 ms
9,628 KB
testcase_25 AC 19 ms
9,136 KB
testcase_26 AC 14 ms
8,604 KB
testcase_27 AC 18 ms
8,504 KB
testcase_28 AC 16 ms
8,340 KB
testcase_29 AC 16 ms
8,660 KB
testcase_30 AC 61 ms
9,680 KB
testcase_31 AC 16 ms
8,672 KB
testcase_32 AC 57 ms
10,188 KB
testcase_33 AC 14 ms
8,336 KB
testcase_34 AC 92 ms
11,436 KB
testcase_35 AC 28 ms
9,100 KB
testcase_36 AC 60 ms
9,420 KB
testcase_37 AC 44 ms
10,536 KB
testcase_38 AC 1,045 ms
16,808 KB
testcase_39 AC 1,087 ms
17,876 KB
testcase_40 AC 14 ms
7,848 KB
testcase_41 AC 13 ms
7,812 KB
testcase_42 AC 12 ms
7,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = [-1 for i in range(K)]
dp = [[[-1 for k in range(D+1)]for j in range(K+1)]for i in range(N+1)]

def dfs(n,k,d):
	if k == K:
		if d == D:
			return True
		else:
			return False
	if n >= N:
		return False
	if dp[n][k][d] != -1:
		return dp[n][k][d]
	for i in range(n+1,N+1):
		ans[k] = i
		if d+i <= D and dfs(i,k+1,d+i):
			return True
		ans[k] = -1
	dp[n][k][d] = False
	return False
if not dfs(0,0,0):
	print(-1)
else:
	print(' '.join([str(i) for i in ans]))
0