結果

問題 No.324 落ちてた閉路グラフ
ユーザー TawaraTawara
提出日時 2015-12-17 11:28:13
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 2,070 ms / 5,000 ms
コード長 350 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 77,060 KB
実行使用メモリ 128,036 KB
最終ジャッジ日時 2024-04-27 16:02:31
合計ジャッジ時間 19,251 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,264 KB
testcase_01 AC 75 ms
75,308 KB
testcase_02 AC 74 ms
75,384 KB
testcase_03 AC 74 ms
75,024 KB
testcase_04 AC 2,003 ms
128,036 KB
testcase_05 AC 206 ms
78,116 KB
testcase_06 AC 2,009 ms
118,916 KB
testcase_07 AC 819 ms
83,860 KB
testcase_08 AC 2,048 ms
121,396 KB
testcase_09 AC 1,149 ms
89,244 KB
testcase_10 AC 2,070 ms
121,652 KB
testcase_11 AC 1,158 ms
89,120 KB
testcase_12 AC 77 ms
76,580 KB
testcase_13 AC 90 ms
77,948 KB
testcase_14 AC 78 ms
76,552 KB
testcase_15 AC 88 ms
77,368 KB
testcase_16 AC 76 ms
75,276 KB
testcase_17 AC 76 ms
75,020 KB
testcase_18 AC 76 ms
75,560 KB
testcase_19 AC 76 ms
75,324 KB
testcase_20 AC 76 ms
75,064 KB
testcase_21 AC 75 ms
75,416 KB
testcase_22 AC 75 ms
75,300 KB
testcase_23 AC 77 ms
75,184 KB
testcase_24 AC 80 ms
75,288 KB
testcase_25 AC 76 ms
75,068 KB
testcase_26 AC 77 ms
75,308 KB
testcase_27 AC 76 ms
75,288 KB
testcase_28 AC 76 ms
74,912 KB
testcase_29 AC 77 ms
75,308 KB
testcase_30 AC 77 ms
75,052 KB
testcase_31 AC 75 ms
75,156 KB
testcase_32 AC 448 ms
79,144 KB
testcase_33 AC 1,472 ms
102,036 KB
testcase_34 AC 1,582 ms
110,224 KB
testcase_35 AC 97 ms
77,500 KB
testcase_36 AC 623 ms
81,692 KB
testcase_37 AC 87 ms
76,944 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 (r,h),v in D.iteritems():
			for l in [0,1]:
				if 0<=r-l<n-1-i:
					k=(r-l,l);u=v+w[i]*h*l
					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