結果
| 問題 |
No.115 遠足のおやつ
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2022-10-18 11:06:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 464 ms / 5,000 ms |
| コード長 | 411 bytes |
| コンパイル時間 | 474 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 44,332 KB |
| 最終ジャッジ日時 | 2024-06-28 20:04:44 |
| 合計ジャッジ時間 | 22,045 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
import sys
readline=sys.stdin.readline
N,D,K=map(int,readline().split())
N=min(N,D)
import numpy as np
dp=np.full((N+1,K+1,D+1),False,dtype=bool)
dp[0][0][0]=True
for n in range(N,0,-1):
dp[N-n+1]|=dp[N-n]
dp[N-n+1,1:,n:]|=dp[N-n,:-1,:-n]
ans_lst=[]
for n in range(1,N+1):
if K and D>=n and dp[N-n,K-1,D-n]:
ans_lst.append(n)
D-=n
K-=1
if K:
ans_lst=[-1]
print(*ans_lst)
vwxyz