CF99B.Help Chef Gerasim
普及-
通过率:0%
时间限制:0.50s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup to another. Now Gerasim wants to check his hypothesis. The good thing is that chef Gerasim always pour the same number of milliliters of juice to all cups in the royal kitchen. Having thoroughly measured the juice in each cup, Gerasim asked you to write a program that will determine from which cup juice was poured to which one; otherwise, the program should determine that this time the pages set the table diligently.
To simplify your task we shall consider the cups to be bottomless so that the juice never overfills a cup and pours out, however much it can be. Besides, by some strange reason in a far away kingdom one can only pour to a cup or from one cup to another an integer number of milliliters of juice.
在遥远的王国中,年轻的侍从们负责为国王摆设餐桌。由于他们极其顽皮,必须时刻监督他们是否正确完成了任务。这一次,御厨格拉西姆觉得侍从们又恶作剧了:他们将某只杯子中的果汁倒进了另一只杯子中。现在,格拉西姆想验证自己的猜想。幸运的是,御厨格拉西姆在皇家厨房中总是向每只杯子中倒入相同毫升数的果汁。在仔细测量了每只杯子中剩余的果汁量后,格拉西姆请你编写一个程序,来确定果汁是从哪只杯子倒到了哪只杯子;否则,程序应判定侍从们这次认真地完成了摆桌任务。
为简化你的任务,我们假设杯子是“无底”的,即无论倒入多少果汁,都不会溢出。此外,出于某种奇怪的原因,在这个遥远的王国中,人们只能以整数毫升为单位向杯子中倒果汁,或在杯子之间互相倾倒果汁。
输入格式
The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104.
第一行包含一个整数 n —— 皇室餐桌上杯子的数量(1≤n≤1000)。接下来的 n 行每行包含一个杯子中果汁的体积 —— 非负整数,且不超过 104。
输出格式
If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the juice was poured (the cups are numbered with consecutive positive integers starting from one in the order in which the cups are described in the input data), b represents the number of the cup into which the juice was poured. Finally, if the given juice's volumes cannot be obtained using no more than one pouring (for example, the pages poured the juice from one cup to another more than once or the royal kitchen maids poured the juice into the cups incorrectly), print "Unrecoverable configuration." (without the quotes).
如果页面没有倒果汁,则输出“Exemplary pages.”(不带引号)。
如果能够确定在恰好一次果汁倾倒过程中所倒出的果汁体积,则输出“v ml. from cup #a to cup #b.”(不带引号),其中 v 表示所倒出的果汁体积,a 表示果汁被倒出的杯子编号(杯子按输入数据中描述的顺序,用从 1 开始的连续正整数编号),b 表示果汁被倒入的杯子编号。
最后,如果给定的果汁体积无法通过至多一次倾倒操作实现(例如,页面将果汁从一个杯子倒入另一个杯子的操作超过一次,或皇家厨房女仆错误地向杯子中注入了果汁),则输出“Unrecoverable configuration.”(不带引号)。
输入输出样例
输入#1
5 270 250 250 230 250
输出#1
20 ml. from cup #4 to cup #1.
输入#2
5 250 250 250 250 250
输出#2
Exemplary pages.
输入#3
5 270 250 249 230 250
输出#3
Unrecoverable configuration.
输入解题思路,AI测评打分。不知道怎么写?