結果

問題 No.107 モンスター
ユーザー qibqib
提出日時 2023-01-18 18:53:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 77,560 KB
最終ジャッジ日時 2023-09-02 12:52:17
合計ジャッジ時間 3,779 ms
ジャッジサーバーID
(参考情報)
judge16 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,404 KB
testcase_01 AC 72 ms
71,588 KB
testcase_02 AC 71 ms
71,596 KB
testcase_03 AC 74 ms
71,336 KB
testcase_04 AC 79 ms
71,492 KB
testcase_05 AC 68 ms
71,424 KB
testcase_06 AC 67 ms
71,512 KB
testcase_07 AC 67 ms
71,348 KB
testcase_08 AC 68 ms
71,456 KB
testcase_09 AC 69 ms
71,288 KB
testcase_10 AC 69 ms
71,272 KB
testcase_11 AC 70 ms
71,412 KB
testcase_12 AC 69 ms
71,204 KB
testcase_13 AC 88 ms
76,752 KB
testcase_14 AC 90 ms
77,228 KB
testcase_15 AC 93 ms
77,064 KB
testcase_16 AC 71 ms
71,292 KB
testcase_17 AC 91 ms
76,904 KB
testcase_18 AC 89 ms
77,356 KB
testcase_19 AC 92 ms
77,012 KB
testcase_20 AC 94 ms
76,412 KB
testcase_21 AC 91 ms
76,856 KB
testcase_22 AC 91 ms
76,724 KB
testcase_23 AC 95 ms
77,096 KB
testcase_24 AC 99 ms
77,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
d = list(map(int, input().split()))

dp = [0 for _ in range(1 << n)]
dp[0] = 100
for mask in range(1 << n):
  if dp[mask] <= 0:
    continue

  lv = 1
  for i in range(n):
    if (mask >> i) & 1 == 1 and d[i] < 0:
      lv += 1

  for i in range(n):
    if (mask >> i) & 1 == 1:
      continue

    nxt = mask | (1 << i)
    dp[nxt] = max(dp[nxt], min(dp[mask] + d[i], lv * 100))

print(dp[-1])
0