AtCoder Regular Contest 144
翻译中…
Problem Statement
翻译中…
You are given positive integers $a$ and $b$ such that $a\leq b$, and a sequence of positive integers $A = (A_1, A_2, \ldots, A_N)$.
翻译中…
On this sequence, you can perform the following operation any number of times (possibly zero):
翻译中…
- Choose distinct indices
$i, j$($1\leq i, j \leq N$). Add$a$to$A_i$and subtract$b$from$A_j$.
翻译中…
Find the maximum possible value of $\min(A_1, A_2, \ldots, A_N)$ after your operations.
翻译中…
Constraints
翻译中…
$2\leq N\leq 3\times 10^5$$1\leq a\leq b\leq 10^9$$1\leq A_i\leq 10^{9}$
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N a b
A_1 A_2 \ldots A_N
翻译中…
Output
翻译中…
Print the maximum possible value of $\min(A_1, A_2, \ldots, A_N)$ after your operations.
翻译中…
样例
Input #1
3 2 2
1 5 9
Output #1
5
Here is one way to achieve $\min(A_1, A_2, A_3) = 5$.
- Perform the operation with $i = 1, j = 3$. $A$ becomes $(3, 5, 7)$.
- Perform the operation with $i = 1, j = 3$. $A$ becomes $(5, 5, 5)$.
Input #2
3 2 3
11 1 2
Output #2
3
Here is one way to achieve $\min(A_1, A_2, A_3) = 3$.
- Perform the operation with $i = 1, j = 3$. $A$ becomes $(13, 1, -1)$.
- Perform the operation with $i = 2, j = 1$. $A$ becomes $(10, 3, -1)$.
- Perform the operation with $i = 3, j = 1$. $A$ becomes $(7, 3, 1)$.
- Perform the operation with $i = 3, j = 1$. $A$ becomes $(4, 3, 3)$.
Input #3
3 1 100
8 5 6
Output #3
5
You can achieve $\min(A_1, A_2, A_3) = 5$ by not performing the operation at all.
Input #4
6 123 321
10 100 1000 10000 100000 1000000
Output #4
90688
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。