結果
| 問題 |
No.107 モンスター
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-14 17:13:35 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 740 ms / 5,000 ms |
| コード長 | 494 bytes |
| コンパイル時間 | 297 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2024-07-23 03:07:16 |
| 合計ジャッジ時間 | 6,165 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
n = int(input())
d = list(map(int, input().split()))
S = 1 << n
dp = [0]*S
dp[0] = 100
for s in range(S):
if dp[s] == 0:
continue
for v in range(n):
if s & (1 << v):
continue
cnt = 0
for u in range(n):
if u == v:
continue
if s & (1 << u) and d[u] < 0:
cnt += 1
hp = min(dp[s]+d[v], 100*(1+cnt))
if dp[s | (1 << v)] < hp:
dp[s | (1 << v)] = hp
print(dp[S-1])