結果

問題 No.324 落ちてた閉路グラフ
ユーザー TawaraTawara
提出日時 2015-12-17 11:52:21
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 2,421 ms / 5,000 ms
コード長 340 bytes
コンパイル時間 1,409 ms
コンパイル使用メモリ 77,828 KB
実行使用メモリ 134,564 KB
最終ジャッジ日時 2023-10-14 12:35:08
合計ジャッジ時間 21,879 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
76,660 KB
testcase_01 AC 67 ms
76,592 KB
testcase_02 AC 64 ms
76,656 KB
testcase_03 AC 67 ms
76,252 KB
testcase_04 AC 2,421 ms
134,564 KB
testcase_05 AC 236 ms
79,444 KB
testcase_06 AC 2,303 ms
124,660 KB
testcase_07 AC 955 ms
86,052 KB
testcase_08 AC 2,383 ms
127,840 KB
testcase_09 AC 1,319 ms
91,984 KB
testcase_10 AC 2,401 ms
127,660 KB
testcase_11 AC 1,321 ms
91,844 KB
testcase_12 AC 71 ms
78,696 KB
testcase_13 AC 81 ms
79,396 KB
testcase_14 AC 67 ms
77,744 KB
testcase_15 AC 76 ms
79,452 KB
testcase_16 AC 68 ms
76,408 KB
testcase_17 AC 65 ms
76,244 KB
testcase_18 AC 68 ms
76,680 KB
testcase_19 AC 67 ms
76,536 KB
testcase_20 AC 65 ms
76,540 KB
testcase_21 AC 66 ms
76,436 KB
testcase_22 AC 67 ms
76,412 KB
testcase_23 AC 67 ms
76,672 KB
testcase_24 AC 68 ms
76,500 KB
testcase_25 AC 65 ms
76,752 KB
testcase_26 AC 65 ms
76,592 KB
testcase_27 AC 66 ms
76,472 KB
testcase_28 AC 66 ms
76,544 KB
testcase_29 AC 67 ms
76,492 KB
testcase_30 AC 68 ms
76,488 KB
testcase_31 AC 69 ms
76,512 KB
testcase_32 AC 523 ms
80,904 KB
testcase_33 AC 1,738 ms
105,692 KB
testcase_34 AC 1,850 ms
115,424 KB
testcase_35 AC 84 ms
79,296 KB
testcase_36 AC 721 ms
84,116 KB
testcase_37 AC 78 ms
79,040 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)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