結果
問題 |
No.324 落ちてた閉路グラフ
|
ユーザー |
![]() |
提出日時 | 2015-12-17 11:55:11 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 347 bytes |
コンパイル時間 | 676 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 14,580 KB |
最終ジャッジ日時 | 2024-09-16 07:27:09 |
合計ジャッジ時間 | 7,226 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | TLE * 1 -- * 33 |
ソースコード
I=lambda:map(int,raw_input().split());n,m=I();w=I() def f(s): D={(s,s):0} for i in range(n-1): T={} for(t,h),v in D.iteritems(): for a in[0,1]: if i-n+1<t+a-m<=0: k=(t+a,a);u=v+w[i]*h*a if k not in T or T[k]<u:T[k]=u D=T return max(v+h*s*w[n-1]for(k,h),v in D.items()) print max(f(0),f(1))if(n>m)*(m>0)else[0,sum(w)][m>0]