結果
問題 |
No.10 +か×か
|
ユーザー |
![]() |
提出日時 | 2021-11-02 03:48:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 31,668 KB |
最終ジャッジ日時 | 2024-10-11 00:57:40 |
合計ジャッジ時間 | 11,203 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 6 |
ソースコード
# Tの制約から半分全列挙を考えてしまったが、ただのDPでした。 # これを解けないのは非常にマズい。 N=int(input()) T=int(input()) A=list(map(int,input().split())) DP=["z"]*(T+1) DP[A[0]]="" for i in range(1,N): NDP=["z"]*(T+1) for j in range(A[0],T+1): if DP[j]!="z": if j+A[i]<=T: NDP[j+A[i]]=min(NDP[j+A[i]],DP[j]+"+") if j*A[i]<=T: NDP[j*A[i]]=min(NDP[j*A[i]],DP[j]+"*") DP=NDP print(DP[T])