結果

問題 No.324 落ちてた閉路グラフ
ユーザー TawaraTawara
提出日時 2015-12-17 11:51:44
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 2,556 ms / 5,000 ms
コード長 339 bytes
コンパイル時間 1,057 ms
コンパイル使用メモリ 77,868 KB
実行使用メモリ 134,616 KB
最終ジャッジ日時 2023-10-14 12:32:28
合計ジャッジ時間 23,036 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,220 KB
testcase_01 AC 71 ms
76,568 KB
testcase_02 AC 71 ms
76,628 KB
testcase_03 AC 67 ms
76,220 KB
testcase_04 AC 2,556 ms
134,616 KB
testcase_05 AC 240 ms
79,700 KB
testcase_06 AC 2,416 ms
124,684 KB
testcase_07 AC 975 ms
86,036 KB
testcase_08 AC 2,495 ms
127,808 KB
testcase_09 AC 1,358 ms
91,828 KB
testcase_10 AC 2,484 ms
128,116 KB
testcase_11 AC 1,379 ms
91,496 KB
testcase_12 AC 73 ms
78,856 KB
testcase_13 AC 82 ms
79,364 KB
testcase_14 AC 72 ms
77,208 KB
testcase_15 AC 79 ms
79,316 KB
testcase_16 AC 69 ms
76,744 KB
testcase_17 AC 70 ms
76,308 KB
testcase_18 AC 67 ms
76,352 KB
testcase_19 AC 70 ms
76,460 KB
testcase_20 AC 68 ms
76,452 KB
testcase_21 AC 79 ms
76,548 KB
testcase_22 AC 65 ms
76,492 KB
testcase_23 AC 72 ms
76,356 KB
testcase_24 AC 72 ms
76,720 KB
testcase_25 AC 68 ms
76,344 KB
testcase_26 AC 69 ms
76,392 KB
testcase_27 AC 66 ms
76,720 KB
testcase_28 AC 70 ms
76,444 KB
testcase_29 AC 67 ms
76,504 KB
testcase_30 AC 65 ms
76,784 KB
testcase_31 AC 67 ms
76,628 KB
testcase_32 AC 533 ms
81,016 KB
testcase_33 AC 1,797 ms
105,568 KB
testcase_34 AC 1,966 ms
115,328 KB
testcase_35 AC 84 ms
79,080 KB
testcase_36 AC 731 ms
83,936 KB
testcase_37 AC 83 ms
79,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

I=lambda:map(int,raw_input().split());n,m=I();w=I()
def f(s):
	D={(s,s):0}
	for i in range(n-1):
		T={}
		for(t,h)in D:
			for a in[0,1]:
				if i-n+1<t+a-m<=0:
					k=(t+a,a);u=D[(t,h)]+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