結果
問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
ユーザー |
|
提出日時 | 2021-12-04 10:48:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,591 ms / 3,000 ms |
コード長 | 699 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 21,880 KB |
最終ジャッジ日時 | 2024-07-06 15:46:01 |
合計ジャッジ時間 | 21,387 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
import sys N,A,B,X,Y = list(map(int,input().split())) H = list(map(int,input().split())) h = sorted(H,reverse = True) def check(K): l = [max(0,i-K) for i in h] count = 0 i = 0 while count < A and i < N: q = l[i] // X if q == 0:break q = min(A - count,q) count += q l[i] -= q * X i += 1 if count < A: l.sort(reverse = True) for i in range(min(A-count,len(l))): l[i] = 0 return sum(l) <= B * Y if check(0): print(0) exit() start = 0 end = 10 ** 9 while start != end: mid = end - (end - start + 1) // 2 if check(mid): end = mid else: start = mid + 1 print(start)