結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
76,200 KB
testcase_01 AC 69 ms
76,680 KB
testcase_02 AC 67 ms
76,364 KB
testcase_03 AC 65 ms
76,536 KB
testcase_04 AC 1,726 ms
129,700 KB
testcase_05 AC 193 ms
79,476 KB
testcase_06 AC 1,744 ms
121,128 KB
testcase_07 AC 711 ms
85,264 KB
testcase_08 AC 1,762 ms
123,112 KB
testcase_09 AC 991 ms
90,848 KB
testcase_10 AC 1,747 ms
123,104 KB
testcase_11 AC 1,000 ms
90,648 KB
testcase_12 RE -
testcase_13 AC 82 ms
79,376 KB
testcase_14 RE -
testcase_15 AC 83 ms
79,244 KB
testcase_16 RE -
testcase_17 AC 69 ms
76,416 KB
testcase_18 AC 66 ms
76,376 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 67 ms
76,516 KB
testcase_22 RE -
testcase_23 AC 72 ms
76,496 KB
testcase_24 RE -
testcase_25 AC 81 ms
76,416 KB
testcase_26 AC 68 ms
76,424 KB
testcase_27 AC 70 ms
76,476 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 69 ms
76,484 KB
testcase_31 AC 66 ms
76,728 KB
testcase_32 AC 394 ms
80,864 KB
testcase_33 AC 1,231 ms
103,844 KB
testcase_34 AC 1,349 ms
112,240 KB
testcase_35 AC 83 ms
79,248 KB
testcase_36 AC 538 ms
83,548 KB
testcase_37 AC 79 ms
79,048 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 [0,1]:
				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