結果

問題 No.107 モンスター
ユーザー roiti46roiti46
提出日時 2015-02-23 22:20:14
言語 Python2
(2.7.18)
結果
AC  
実行時間 287 ms / 5,000 ms
コード長 384 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 6,496 KB
実行使用メモリ 6,448 KB
最終ジャッジ日時 2023-08-22 22:46:02
合計ジャッジ時間 3,849 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,792 KB
testcase_01 AC 11 ms
5,792 KB
testcase_02 AC 11 ms
5,852 KB
testcase_03 AC 10 ms
5,952 KB
testcase_04 AC 12 ms
6,096 KB
testcase_05 AC 11 ms
5,796 KB
testcase_06 AC 11 ms
5,852 KB
testcase_07 AC 11 ms
6,080 KB
testcase_08 AC 11 ms
5,852 KB
testcase_09 AC 11 ms
5,856 KB
testcase_10 AC 10 ms
6,004 KB
testcase_11 AC 11 ms
5,868 KB
testcase_12 AC 11 ms
5,872 KB
testcase_13 AC 106 ms
5,920 KB
testcase_14 AC 226 ms
6,304 KB
testcase_15 AC 226 ms
6,348 KB
testcase_16 AC 11 ms
6,100 KB
testcase_17 AC 43 ms
5,976 KB
testcase_18 AC 119 ms
6,288 KB
testcase_19 AC 118 ms
6,276 KB
testcase_20 AC 137 ms
6,180 KB
testcase_21 AC 101 ms
5,984 KB
testcase_22 AC 190 ms
6,084 KB
testcase_23 AC 287 ms
6,448 KB
testcase_24 AC 198 ms
6,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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