問題一覧 > 通常問題

No.1816 MUL-DIV Game

レベル : / AI推定難易度 : 1200 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 158
作問者 : nok0 / テスター : riano
お気に入りにしたユーザー ProblemId : 7536 / 自分の提出
問題文最終更新日: 2022-01-21 23:34:48
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 328 (順位表) の他の問題:

Problem Statement

$N$ integers $A_1,A_2,\dots A_N $ are written on a blackboard.

Alice and Bob play a game using the integers written on the blackboard. Alice goes first, and they alternately perform the following operations until exactly $1$ integer remains on the blackboard.

  • Alice's operation

    • Choose $2$ integers written on the blackboard (call the chosen integers $x$ and $y$). Erase $x$ and $y$ from the blackboard, and write $x\cdot y$ on the blackboard.
  • Bob's operation

    • Choose $2$ integers written on the blackboard (call the chosen integers $x$ and $y$). Erase $x$ and $y$ from the blackboard, and write $\lceil \frac{x}{y} \rceil$ on the blackboard.

Let $\mathrm{ans}$ be the only integer written on the blackboard at the end. Alice's goal is to maximize $\mathrm{ans}$, and Bob's goal is to minimize $\mathrm{ans}$.

Find $\mathrm{ans}$ when both players play optimally toward their goals.

Here, for a real number $a$, $\lceil a \rceil$ denotes the smallest integer greater than or equal to $a$.

Constraints

  • All inputs are integers.
  • $1 \le N\le 10^5$
  • $1 \le A_i \le 10^9$

Input

$N$
$A_1$ $A_2$ $\dots$ $A_N$

Output

Output $\mathrm{ans}$.

Sample

Sample 1
Input
2
3 5
Output
15

Alice erases $3$ and $5$ and writes $3\cdot5 = 15$. Thus, $\mathrm{ans}=15$.

Sample 2
Input
3
1 1 1
Output
1

Alice erases $1$ and $1$ and writes $1\cdot1 = 1$. Bob erases $1$ and $1$ and writes $\lceil \frac{1}{1} \rceil=1$. Thus, $\mathrm{ans}=1$.

Sample 3
Input
1
10
Output
10

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。