結果

問題 No.107 モンスター
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-11 02:09:48
言語 Python2
(2.7.18)
結果
AC  
実行時間 180 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 6,652 KB
実行使用メモリ 8,624 KB
最終ジャッジ日時 2023-08-22 22:47:11
合計ジャッジ時間 2,525 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,940 KB
testcase_01 AC 11 ms
6,036 KB
testcase_02 AC 11 ms
5,876 KB
testcase_03 AC 11 ms
5,932 KB
testcase_04 AC 11 ms
5,876 KB
testcase_05 AC 12 ms
5,944 KB
testcase_06 AC 11 ms
5,944 KB
testcase_07 AC 11 ms
5,892 KB
testcase_08 AC 11 ms
5,988 KB
testcase_09 AC 11 ms
5,980 KB
testcase_10 AC 11 ms
6,108 KB
testcase_11 AC 11 ms
5,864 KB
testcase_12 AC 11 ms
6,040 KB
testcase_13 AC 86 ms
6,456 KB
testcase_14 AC 166 ms
7,272 KB
testcase_15 AC 160 ms
7,256 KB
testcase_16 AC 11 ms
5,988 KB
testcase_17 AC 32 ms
6,252 KB
testcase_18 AC 39 ms
8,372 KB
testcase_19 AC 39 ms
8,432 KB
testcase_20 AC 103 ms
6,604 KB
testcase_21 AC 74 ms
6,460 KB
testcase_22 AC 142 ms
7,252 KB
testcase_23 AC 180 ms
8,624 KB
testcase_24 AC 118 ms
8,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
D=map(int,raw_input().split())
dp=[0 for i in range(1<<N)]
dp[0]=100
for i in range(1<<N):
    if dp[i]<=0:
        continue
    power=100
    for j in range(N):
        if i&(1<<j) !=0 and D[j]<0:
            power+=100
    for j in range(N):
        if i&(1<<j)==0:
            if D[j]>0:
                dp[i|(1<<j)]=max(dp[i|(1<<j)],min(power,dp[i]+D[j]))
            else:
                dp[i|(1<<j)]=max(dp[i|(1<<j)],dp[i]+D[j])
print dp[(1<<N)-1]
0