結果

問題 No.324 落ちてた閉路グラフ
ユーザー TawaraTawara
提出日時 2015-12-17 11:56:39
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 2,104 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 77,568 KB
実行使用メモリ 129,696 KB
最終ジャッジ日時 2023-10-14 12:37:41
合計ジャッジ時間 20,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
76,500 KB
testcase_01 AC 76 ms
76,284 KB
testcase_02 AC 77 ms
76,468 KB
testcase_03 AC 78 ms
76,544 KB
testcase_04 AC 2,098 ms
129,696 KB
testcase_05 AC 215 ms
79,760 KB
testcase_06 AC 2,054 ms
120,552 KB
testcase_07 AC 836 ms
85,340 KB
testcase_08 AC 2,101 ms
123,548 KB
testcase_09 AC 1,168 ms
90,840 KB
testcase_10 AC 2,104 ms
123,476 KB
testcase_11 AC 1,198 ms
90,536 KB
testcase_12 AC 82 ms
78,544 KB
testcase_13 AC 92 ms
79,296 KB
testcase_14 AC 78 ms
77,664 KB
testcase_15 AC 89 ms
79,240 KB
testcase_16 AC 74 ms
76,324 KB
testcase_17 AC 74 ms
76,488 KB
testcase_18 AC 76 ms
76,900 KB
testcase_19 AC 76 ms
76,624 KB
testcase_20 AC 77 ms
76,496 KB
testcase_21 AC 76 ms
76,544 KB
testcase_22 AC 76 ms
76,544 KB
testcase_23 AC 76 ms
76,492 KB
testcase_24 AC 77 ms
76,432 KB
testcase_25 AC 77 ms
76,736 KB
testcase_26 AC 75 ms
76,380 KB
testcase_27 AC 76 ms
76,528 KB
testcase_28 AC 75 ms
76,324 KB
testcase_29 AC 77 ms
76,404 KB
testcase_30 AC 77 ms
76,872 KB
testcase_31 AC 76 ms
76,464 KB
testcase_32 AC 458 ms
80,884 KB
testcase_33 AC 1,508 ms
103,372 KB
testcase_34 AC 1,628 ms
112,148 KB
testcase_35 AC 95 ms
78,964 KB
testcase_36 AC 637 ms
83,360 KB
testcase_37 AC 90 ms
78,964 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.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