結果

問題 No.107 モンスター
ユーザー sjikisjiki
提出日時 2021-09-27 00:37:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 10,584 KB
最終ジャッジ日時 2023-09-19 04:26:49
合計ジャッジ時間 5,605 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,500 KB
testcase_01 AC 18 ms
8,456 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 19 ms
8,504 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 19 ms
8,440 KB
testcase_09 AC 19 ms
8,436 KB
testcase_10 AC 19 ms
8,448 KB
testcase_11 WA -
testcase_12 AC 19 ms
8,440 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 19 ms
8,432 KB
testcase_17 AC 79 ms
8,812 KB
testcase_18 AC 625 ms
10,556 KB
testcase_19 AC 619 ms
10,552 KB
testcase_20 AC 156 ms
8,972 KB
testcase_21 AC 153 ms
9,048 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 620 ms
10,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
inf=10**16
n = int(input())
l = 1
d = list(map(int,input().split()))
dp=[-inf]*(1<<n)
dp[0] = 100
for bit in range(1<<n):
    pre=dp[bit]
    for i in range(n):
        if bit>>i&1:continue
        nbit=bit|1<<i
        if d[i] > 0:
            power = d[i] + pre
        else:
            power = pre +d[i]
            l += 1
        if power < l * 100:
            energy = power
        else:
            energy = l * 100
        
        dp[nbit]=max(dp[nbit],energy)
print(dp[-1])
0