結果

問題 No.107 モンスター
ユーザー roiti46roiti46
提出日時 2015-02-23 22:20:35
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 150 ms / 5,000 ms
コード長 384 bytes
コンパイル時間 1,825 ms
コンパイル使用メモリ 77,444 KB
実行使用メモリ 80,200 KB
最終ジャッジ日時 2023-08-22 22:46:13
合計ジャッジ時間 3,926 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,448 KB
testcase_01 AC 76 ms
76,340 KB
testcase_02 AC 76 ms
76,372 KB
testcase_03 AC 77 ms
76,464 KB
testcase_04 AC 76 ms
76,464 KB
testcase_05 AC 75 ms
76,612 KB
testcase_06 AC 76 ms
76,404 KB
testcase_07 AC 76 ms
76,432 KB
testcase_08 AC 77 ms
76,612 KB
testcase_09 AC 75 ms
76,536 KB
testcase_10 AC 75 ms
76,216 KB
testcase_11 AC 76 ms
76,352 KB
testcase_12 AC 77 ms
76,372 KB
testcase_13 AC 111 ms
79,740 KB
testcase_14 AC 137 ms
79,688 KB
testcase_15 AC 139 ms
79,812 KB
testcase_16 AC 78 ms
76,572 KB
testcase_17 AC 104 ms
79,508 KB
testcase_18 AC 109 ms
79,948 KB
testcase_19 AC 107 ms
79,872 KB
testcase_20 AC 119 ms
79,464 KB
testcase_21 AC 112 ms
79,648 KB
testcase_22 AC 138 ms
80,200 KB
testcase_23 AC 150 ms
79,972 KB
testcase_24 AC 125 ms
79,916 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