結果
| 問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 22:40:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 843 bytes |
| コンパイル時間 | 162 ms |
| コンパイル使用メモリ | 82,448 KB |
| 実行使用メモリ | 345,684 KB |
| 最終ジャッジ日時 | 2024-11-25 20:19:14 |
| 合計ジャッジ時間 | 92,360 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 20 |
ソースコード
import sys
input = sys.stdin.readline
from collections import *
def judge(k):
l = []
S = 0
a = A
decr = 0
for Hi in H:
Hi = max(0, Hi-k)
S += Hi
if a>Hi//X:
decr += X*(Hi//X)
a -= Hi//X
else:
decr += X*a
a = 0
l.append((Hi%X, 1))
l.sort(reverse=True)
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())