結果

問題 No.107 モンスター
ユーザー roiti46roiti46
提出日時 2015-02-23 22:05:49
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 404 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 1,167 ms
コンパイル使用メモリ 77,848 KB
実行使用メモリ 80,380 KB
最終ジャッジ日時 2023-08-22 22:44:11
合計ジャッジ時間 6,425 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,624 KB
testcase_01 AC 73 ms
76,216 KB
testcase_02 AC 74 ms
76,344 KB
testcase_03 AC 71 ms
76,576 KB
testcase_04 AC 73 ms
76,628 KB
testcase_05 AC 72 ms
76,368 KB
testcase_06 AC 72 ms
76,072 KB
testcase_07 AC 71 ms
76,468 KB
testcase_08 AC 73 ms
76,456 KB
testcase_09 AC 74 ms
76,244 KB
testcase_10 AC 74 ms
76,276 KB
testcase_11 AC 73 ms
76,308 KB
testcase_12 AC 73 ms
76,100 KB
testcase_13 AC 146 ms
79,472 KB
testcase_14 AC 234 ms
80,144 KB
testcase_15 AC 231 ms
79,696 KB
testcase_16 AC 76 ms
76,396 KB
testcase_17 AC 126 ms
79,388 KB
testcase_18 AC 382 ms
79,776 KB
testcase_19 AC 383 ms
80,188 KB
testcase_20 AC 159 ms
79,524 KB
testcase_21 AC 161 ms
79,568 KB
testcase_22 AC 224 ms
79,712 KB
testcase_23 AC 404 ms
80,380 KB
testcase_24 AC 382 ms
79,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
D = map(int,raw_input().split())
bad = 0
for i in xrange(N):
    if D[i] < 0: bad |= 1 << i
    
dp = [0]*(1 << N)
dp[0] = 100
for bit in xrange(1 << N):
    for i in xrange(N):
        beat = bin(bad & bit).count("1")
        if dp[bit] == 0 or bit & (1 << i): continue
        if D[i] < 0: dp[bit | 1 << i] = max(dp[bit | 1 << i], dp[bit]+D[i])
        else: dp[bit | 1 << i] = max(dp[bit | 1 << i], min(100*(beat+1), dp[bit]+D[i]))
print dp[(1 << N)-1]
0