結果

問題 No.324 落ちてた閉路グラフ
ユーザー TawaraTawara
提出日時 2015-12-17 11:53:16
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,931 ms / 5,000 ms
コード長 344 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 78,008 KB
実行使用メモリ 146,360 KB
最終ジャッジ日時 2023-10-14 12:35:42
合計ジャッジ時間 18,183 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
76,672 KB
testcase_01 AC 69 ms
76,436 KB
testcase_02 AC 69 ms
76,420 KB
testcase_03 AC 68 ms
76,512 KB
testcase_04 AC 1,864 ms
146,360 KB
testcase_05 AC 198 ms
79,640 KB
testcase_06 AC 1,896 ms
134,532 KB
testcase_07 AC 766 ms
87,712 KB
testcase_08 AC 1,917 ms
138,536 KB
testcase_09 AC 1,070 ms
94,380 KB
testcase_10 AC 1,931 ms
138,912 KB
testcase_11 AC 1,107 ms
94,408 KB
testcase_12 AC 74 ms
78,588 KB
testcase_13 AC 83 ms
79,480 KB
testcase_14 AC 73 ms
77,408 KB
testcase_15 AC 82 ms
79,092 KB
testcase_16 AC 69 ms
76,288 KB
testcase_17 AC 70 ms
76,532 KB
testcase_18 AC 70 ms
76,408 KB
testcase_19 AC 71 ms
76,300 KB
testcase_20 AC 70 ms
76,600 KB
testcase_21 AC 71 ms
76,360 KB
testcase_22 AC 72 ms
76,380 KB
testcase_23 AC 72 ms
76,724 KB
testcase_24 AC 70 ms
76,292 KB
testcase_25 AC 72 ms
76,536 KB
testcase_26 AC 70 ms
76,528 KB
testcase_27 AC 71 ms
76,404 KB
testcase_28 AC 68 ms
76,460 KB
testcase_29 AC 70 ms
76,648 KB
testcase_30 AC 70 ms
76,464 KB
testcase_31 AC 69 ms
76,892 KB
testcase_32 AC 419 ms
81,148 KB
testcase_33 AC 1,389 ms
111,640 KB
testcase_34 AC 1,508 ms
123,020 KB
testcase_35 AC 87 ms
79,088 KB
testcase_36 AC 590 ms
84,596 KB
testcase_37 AC 82 ms
79,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

I=lambda:map(int,raw_input().split());n,m=I();w=I()
def f(s):
	D={(s,s):0}
	for i in xrange(n-1):
		T={}
		for(t,h),v in D.items():
			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