CF48C.The Race
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Every year a race takes place on the motorway between cities A and B. This year Vanya decided to take part in the race and drive his own car that has been around and bears its own noble name — The Huff-puffer.
So, Vasya leaves city A on the Huff-puffer, besides, at the very beginning he fills the petrol tank with α liters of petrol (α ≥ 10 is Vanya's favorite number, it is not necessarily integer). Petrol stations are located on the motorway at an interval of 100 kilometers, i.e. the first station is located 100 kilometers away from the city A, the second one is 200 kilometers away from the city A, the third one is 300 kilometers away from the city A and so on. The Huff-puffer spends 10 liters of petrol every 100 kilometers.
Vanya checks the petrol tank every time he passes by a petrol station. If the petrol left in the tank is not enough to get to the next station, Vanya fills the tank with α liters of petrol. Otherwise, he doesn't stop at the station and drives on.
For example, if α = 43.21, then the car will be fuelled up for the first time at the station number 4, when there'll be 3.21 petrol liters left. After the fuelling up the car will have 46.42 liters. Then Vanya stops at the station number 8 and ends up with 6.42 + 43.21 = 49.63 liters. The next stop is at the station number 12, 9.63 + 43.21 = 52.84. The next stop is at the station number 17 and so on.
You won't believe this but the Huff-puffer has been leading in the race! Perhaps it is due to unexpected snow. Perhaps it is due to video cameras that have been installed along the motorway which register speed limit breaking. Perhaps it is due to the fact that Vanya threatened to junk the Huff-puffer unless the car wins. Whatever the reason is, the Huff-puffer is leading, and jealous people together with other contestants wrack their brains trying to think of a way to stop that outrage.
One way to do this is to mine the next petrol station where Vanya will stop. Your task is to calculate at which station this will happen and warn Vanya. You don't know the α number, however, you are given the succession of the numbers of the stations where Vanya has stopped. Find the number of the station where the next stop will be.
每年,城市 A 与城市 B 之间的高速公路上都会举行一场赛车比赛。今年,瓦尼亚决定参赛,并驾驶他那辆历史悠久、拥有高贵名称——“呼哧喘气者”(The Huff-puffer)的爱车。
于是,瓦西亚从城市 A 出发,驾驶“呼哧喘气者”上路;出发时,他将油箱加满 α 升汽油(α ≥ 10,这是瓦尼亚最钟爱的数字,不一定是整数)。加油站沿高速公路每隔 100 公里设置一座:第一座加油站距城市 A 100 公里,第二座距城市 A 200 公里,第三座距城市 A 300 公里,依此类推。“呼哧喘气者”每行驶 100 公里消耗 10 升汽油。
每当瓦尼亚经过一座加油站时,他都会检查油箱剩余油量。若剩余油量不足以支撑他抵达下一座加油站,则他在该站加满 α 升汽油;否则,他不停留,继续前行。
例如,若 α = 43.21,则汽车首次加油发生在第 4 号加油站,此时油箱中剩余 3.21 升汽油;加油后油量变为 3.21 + 43.21 = 46.42 升。随后,瓦尼亚在第 8 号加油站再次停车,此时剩余油量为 6.42 升,加油后变为 6.42 + 43.21 = 49.63 升。下一次停车在第 12 号加油站,剩余 9.63 升,加油后为 9.63 + 43.21 = 52.84 升。再下一次停车在第 17 号加油站,依此类推。
你可能难以置信,但“呼哧喘气者”目前正领跑比赛!或许是因为突如其来的降雪;或许是因为高速公路沿线安装的测速摄像头,实时监控超速行为;又或许是因为瓦尼亚扬言:若此车不能夺冠,便将其报废拆解。无论原因如何,“呼哧喘气者”确已领先,而心怀嫉妒的其他选手与围观者正绞尽脑汁,试图找到办法阻止这场“暴行”。
其中一种手段,就是在瓦尼亚下一次将要停靠的加油站处埋设地雷。你的任务是计算出该加油站的编号,并向瓦尼亚发出预警。你并不知道 α 的具体数值,但你已获知瓦尼亚此前所有停靠加油站的编号序列。请据此推断出他下一次停靠的加油站编号。
输入格式
The first line contains an integer n (1 ≤ n ≤ 1000) which represents the number of petrol stations where Vanya has stopped. The next line has n space-separated integers which represent the numbers of the stations. The numbers are positive and do not exceed 106, they are given in the increasing order. No two numbers in the succession match. It is guaranteed that there exists at least one number α ≥ 10, to which such a succession of stops corresponds.
第一行包含一个整数 n(1≤n≤1000),表示万尼亚停靠的加油站数量。
下一行包含 n 个以空格分隔的整数,表示这些加油站的编号。这些编号均为正整数,且不超过 106,按严格递增顺序给出。序列中不存在两个相等的数。
保证至少存在一个 α≥10,使得该停靠序列与之对应。
输出格式
Print in the first line "unique" (without quotes) if the answer can be determined uniquely. In the second line print the number of the station where the next stop will take place. If the answer is not unique, print in the first line "not unique".
如果答案可以唯一确定,在第一行输出 "unique"(不带引号)。
在第二行输出下一个停靠站的编号。
如果答案不唯一,在第一行输出 "not unique"。
输入输出样例
输入#1
3 1 2 4
输出#1
unique 5
输入#2
2 1 2
输出#2
not unique
说明/提示
In the second example the answer is not unique. For example, if α = 10, we'll have such a sequence as 1, 2, 3, and if α = 14, the sequence will be 1, 2, 4.
在第二个例子中,答案不唯一。例如,若 α = 10,则得到的序列为 1, 2, 3;若 α = 14,则序列为 1, 2, 4。
输入解题思路,AI测评打分。不知道怎么写?