「Daily OI Round 3」Pigeon

Luogu
IDLGP10126
Time1000ms
Memory512MB
DifficultyP3
洛谷原创Special JudgeO2优化
recollect_i 给了你长度为 $n$ 的序列 $x$,你需要求出一个实数 $y$ 使得对于所有 $1\leq i<j\leq n$,$\vert x_j-y\vert>\vert x_i-y\vert$,或报告无解。 ## Input 第一行一个整数 $n$,表示序列长度。 第二行 $n$ 个整数 $x$,表示序列。 ## Output 如果有解,第一行输出字符串 `lovely`,第二行输出一个实数 $y$。 为了避免精度问题,如果您输出的方案满足对于所有 $ 1\leq i<j\leq n$,$\vert x_j-y\vert-\vert x_i-y\vert>10^{-6}$,则认为您的答案正确。 同时您需要保证 $-2\times 10^9\leq y\leq 2\times 10^9$,且 $y$ 的小数点后不超过 $10$ 位,否则无法保证评测的正确性。 如果无解,一行输出字符串 `pigeon`。 [samples] ## Background > 最近,忙吗,也不说打个电话。哦,是吗,嘿嘿原来没给过你号码。但这,不是,你不找我的理由,下次罚你陪我等到太阳出头。——recollect_i 的博客 ## Note #### 【提示】 输出格式中 $>10^{-6}$ 只是为了避免精度问题,您可以当成要求 $\vert x_j-y\vert>\vert x_i-y\vert$。 可以证明,如果有解,则一定存在 $y$ 满足 $-2\times 10^{9}\leq y\leq2\times 10^{9}$ 且对于所有 $1\leq i<j\leq n$,$\vert x_j-y\vert-\vert x_i-y\vert>0.2$,且小数点后位数不超过 $3$。 #### 【数据范围】 对于全部数据保证:$5\leq n\leq10^5$,$-10^9\leq x_i\leq10^9$。
Samples
Input #1
5
1 2 3 4 5
Output #1
lovely
-114514
Input #2
5
3 2 1 6 7
Output #2
lovely
3.1416
Input #3
5
3 2 1 4 5
Output #3
pigeon
API Response (JSON)
{
  "problem": {
    "name": "「Daily OI Round 3」Pigeon",
    "description": {
      "content": "recollect_i 给了你长度为 $n$ 的序列 $x$,你需要求出一个实数 $y$ 使得对于所有 $1\\leq i<j\\leq n$,$\\vert x_j-y\\vert>\\vert x_i-y\\vert$,或报告无解。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P3"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP10126"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "recollect_i 给了你长度为 $n$ 的序列 $x$,你需要求出一个实数 $y$ 使得对于所有 $1\\leq i<j\\leq n$,$\\vert x_j-y\\vert>\\vert x_i-y\\vert$,或报告无解。\n\n## Input\n\n第一行一个整数 $n$,表示序列长度。\n\n第二行 $n$ 个整数 $x$,表示序列。\n\n## Output\n\n如果有解,第一行输出字符串 `lovely...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments