結果

問題 No.115 遠足のおやつ
ユーザー tookunn_1213tookunn_1213
提出日時 2017-09-24 20:44:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 426 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 93,052 KB
最終ジャッジ日時 2023-08-31 00:45:11
合計ジャッジ時間 6,357 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,532 KB
testcase_01 AC 76 ms
75,084 KB
testcase_02 AC 90 ms
76,112 KB
testcase_03 AC 75 ms
74,752 KB
testcase_04 AC 110 ms
79,712 KB
testcase_05 AC 75 ms
70,524 KB
testcase_06 AC 73 ms
70,904 KB
testcase_07 AC 76 ms
74,384 KB
testcase_08 AC 76 ms
75,088 KB
testcase_09 AC 75 ms
74,652 KB
testcase_10 AC 74 ms
75,096 KB
testcase_11 AC 75 ms
75,176 KB
testcase_12 AC 77 ms
74,656 KB
testcase_13 AC 74 ms
71,096 KB
testcase_14 AC 83 ms
75,412 KB
testcase_15 AC 103 ms
78,104 KB
testcase_16 AC 90 ms
75,972 KB
testcase_17 AC 79 ms
74,880 KB
testcase_18 AC 77 ms
74,884 KB
testcase_19 AC 76 ms
74,620 KB
testcase_20 AC 73 ms
74,648 KB
testcase_21 AC 74 ms
74,520 KB
testcase_22 AC 110 ms
78,264 KB
testcase_23 AC 91 ms
75,748 KB
testcase_24 AC 147 ms
79,744 KB
testcase_25 AC 78 ms
75,528 KB
testcase_26 AC 76 ms
74,780 KB
testcase_27 AC 81 ms
75,924 KB
testcase_28 AC 87 ms
75,652 KB
testcase_29 AC 77 ms
75,296 KB
testcase_30 AC 122 ms
78,236 KB
testcase_31 AC 78 ms
75,840 KB
testcase_32 AC 100 ms
78,896 KB
testcase_33 AC 76 ms
75,152 KB
testcase_34 AC 113 ms
79,584 KB
testcase_35 AC 83 ms
75,936 KB
testcase_36 AC 164 ms
80,056 KB
testcase_37 AC 86 ms
76,044 KB
testcase_38 AC 412 ms
92,376 KB
testcase_39 AC 426 ms
93,052 KB
testcase_40 AC 68 ms
71,100 KB
testcase_41 AC 69 ms
70,920 KB
testcase_42 AC 70 ms
70,860 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