結果

問題 No.107 モンスター
ユーザー roiti46roiti46
提出日時 2015-02-23 22:01:07
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 523 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 6,416 KB
最終ジャッジ日時 2023-09-06 03:24:06
合計ジャッジ時間 21,555 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,008 KB
testcase_01 AC 11 ms
5,856 KB
testcase_02 AC 11 ms
6,008 KB
testcase_03 AC 12 ms
5,948 KB
testcase_04 AC 12 ms
5,972 KB
testcase_05 AC 11 ms
5,952 KB
testcase_06 AC 12 ms
6,008 KB
testcase_07 AC 11 ms
6,008 KB
testcase_08 AC 11 ms
5,972 KB
testcase_09 AC 12 ms
5,936 KB
testcase_10 AC 12 ms
6,036 KB
testcase_11 AC 11 ms
5,936 KB
testcase_12 AC 13 ms
5,960 KB
testcase_13 AC 2,119 ms
5,920 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 15 ms
5,976 KB
testcase_17 AC 889 ms
6,012 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

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 loop in xrange(N):
    for i in xrange(N):
        for bit in xrange(1 << 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