結果

問題 No.107 モンスター
ユーザー TawaraTawara
提出日時 2015-12-30 21:54:28
言語 Python2
(2.7.18)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 256 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 6,652 KB
実行使用メモリ 7,540 KB
最終ジャッジ日時 2023-08-22 23:16:25
合計ジャッジ時間 2,741 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,048 KB
testcase_01 AC 11 ms
5,988 KB
testcase_02 AC 11 ms
5,984 KB
testcase_03 AC 11 ms
6,164 KB
testcase_04 AC 11 ms
6,008 KB
testcase_05 AC 11 ms
5,972 KB
testcase_06 AC 12 ms
6,108 KB
testcase_07 AC 12 ms
6,196 KB
testcase_08 AC 11 ms
6,060 KB
testcase_09 AC 11 ms
6,096 KB
testcase_10 AC 11 ms
5,972 KB
testcase_11 AC 11 ms
5,912 KB
testcase_12 AC 11 ms
5,988 KB
testcase_13 AC 76 ms
6,308 KB
testcase_14 AC 152 ms
7,092 KB
testcase_15 AC 153 ms
6,988 KB
testcase_16 AC 11 ms
5,964 KB
testcase_17 AC 30 ms
6,276 KB
testcase_18 AC 33 ms
7,012 KB
testcase_19 AC 34 ms
7,120 KB
testcase_20 AC 96 ms
6,592 KB
testcase_21 AC 70 ms
6,432 KB
testcase_22 AC 124 ms
6,820 KB
testcase_23 AC 161 ms
7,540 KB
testcase_24 AC 104 ms
7,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=input();D=map(int,raw_input().split());T=1<<N
H=[0]*T;MH=[0]*T;H[0]=MH[0]=100
for i in xrange(T):
	if H[i]<=0:continue
	for j in xrange(N):
		b=1<<j
		if b&i:continue
		n=b+i;h=min(H[i]+D[j],MH[i])
		H[n]=max(H[n],h);MH[n]=MH[i]+100*(D[j]<0)
print H[T-1]
0