結果

問題 No.324 落ちてた閉路グラフ
ユーザー TawaraTawara
提出日時 2015-12-17 11:55:11
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 347 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 6,708 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-14 12:37:09
合計ジャッジ時間 7,521 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,004 KB
testcase_01 AC 12 ms
6,048 KB
testcase_02 AC 11 ms
5,960 KB
testcase_03 AC 11 ms
5,928 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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]
0