結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 18:05:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,368 bytes |
| コンパイル時間 | 282 ms |
| コンパイル使用メモリ | 81,908 KB |
| 実行使用メモリ | 103,400 KB |
| 最終ジャッジ日時 | 2025-06-12 18:05:50 |
| 合計ジャッジ時間 | 6,815 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 17 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N = int(input[idx])
idx +=1
A = list(map(int, input[idx:idx+N]))
idx +=N
B = list(map(int, input[idx:idx+N]))
idx +=N
min_max = float('inf')
# Precompute all possible enemy orders
enemy_orders = []
for k in range(N):
order = B[k:] + B[:k]
enemy_orders.append(order)
for k in range(N):
current_A = A.copy()
selected = [False] * N
count = [0] * N
order = enemy_orders[k]
for b in order:
min_val = min(current_A)
candidates = []
for i in range(N):
if current_A[i] == min_val:
candidates.append(i)
# Find first unselected in candidates
chosen = -1
for i in candidates:
if not selected[i]:
chosen = i
break
if chosen == -1:
chosen = candidates[0]
count[chosen] +=1
current_A[chosen] += b // 2
selected[chosen] = True
current_max = max(count)
if current_max < min_max:
min_max = current_max
if min_max == 1:
break # Can't get better than 1
print(min_max)
if __name__ == '__main__':
main()
gew1fw