結果
| 問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 21:47:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 725 bytes |
| コンパイル時間 | 334 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 336,084 KB |
| 最終ジャッジ日時 | 2024-11-25 17:57:08 |
| 合計ジャッジ時間 | 103,755 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 TLE * 23 |
ソースコード
import sys
input = sys.stdin.readline
from collections import *
def judge(k):
l = []
S = 0
for Hi in H:
Hi = max(0, Hi-k)
S += Hi
l.append((X, Hi//X))
l.append((Hi%X, 1))
l.sort(reverse=True)
decr = 0
a = A
for v, c in l:
if a>c:
decr += v*c
a -= c
else:
decr += v*a
break
return S-decr<=B*Y
def binary_search():
l, r = 0, 10**10
while l<=r:
m = (l+r)//2
if judge(m):
r = m-1
else:
l = m+1
return l
N, A, B, X, Y = map(int, input().split())
H = list(map(int, input().split()))
print(binary_search())