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