結果

問題 No.324 落ちてた閉路グラフ
ユーザー TawaraTawara
提出日時 2015-12-17 11:08:29
言語 PyPy2
(7.3.15)
結果
RE  
実行時間 -
コード長 353 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 77,988 KB
実行使用メモリ 122,784 KB
最終ジャッジ日時 2023-10-14 12:30:57
合計ジャッジ時間 16,166 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
76,508 KB
testcase_01 AC 68 ms
76,552 KB
testcase_02 AC 65 ms
76,388 KB
testcase_03 AC 68 ms
76,504 KB
testcase_04 AC 1,606 ms
122,784 KB
testcase_05 AC 186 ms
79,268 KB
testcase_06 AC 1,634 ms
115,732 KB
testcase_07 AC 678 ms
84,228 KB
testcase_08 AC 1,662 ms
118,004 KB
testcase_09 AC 948 ms
89,500 KB
testcase_10 AC 1,683 ms
118,016 KB
testcase_11 AC 965 ms
89,068 KB
testcase_12 RE -
testcase_13 AC 82 ms
79,436 KB
testcase_14 RE -
testcase_15 AC 79 ms
79,288 KB
testcase_16 RE -
testcase_17 AC 66 ms
76,448 KB
testcase_18 AC 67 ms
76,580 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 67 ms
76,420 KB
testcase_22 RE -
testcase_23 AC 72 ms
76,688 KB
testcase_24 RE -
testcase_25 AC 67 ms
76,540 KB
testcase_26 AC 66 ms
76,540 KB
testcase_27 AC 67 ms
76,300 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 66 ms
76,244 KB
testcase_31 AC 70 ms
76,268 KB
testcase_32 AC 377 ms
80,396 KB
testcase_33 AC 1,165 ms
100,688 KB
testcase_34 AC 1,301 ms
107,716 KB
testcase_35 AC 87 ms
79,392 KB
testcase_36 AC 517 ms
82,672 KB
testcase_37 AC 78 ms
79,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

I=lambda:map(int,raw_input().split());n,m=I();w=I()
def f(s):
	D={(m-s,s):0}
	for i in xrange(n-1):
		T={}
		for (k,h),v in D.iteritems():
			for l in xrange(2):
				if 0<=k-l<n-1-i:
					nk=(k-l,l);nv=v+w[i]*h*l
					if nk not in T or T[nk]<nv:T[nk]=nv
		D=T
	return max(v+h*s*w[n-1]for(k,h),v in D.items())
print[[max(f(0),f(1)),sum(w)][m==n],0][m==0]
0