A8056 | The Race
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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 $10^{6}$ , 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.
输出格式
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".
输入输出样例
输入 #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$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted