#abc297a. A - Double Click
A - Double Click
Score : points
问题描述
Takahashi 在时间 开启了一台计算机,并在不同时间点击了鼠标共 次。第 次()的点击发生在时间 。
若他在时间 和时间 (其中 )连续点击鼠标,如果满足 ,则称在时间 发生了一次双击。
请问第一次双击发生的时间是什么?如果没有发生过双击,则输出 -1
。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi turned on a computer at time and clicked the mouse times. The -th click was at time .
If he consecutively clicked the mouse at time and time (where ), a double click is said to be fired at time if and only if .
What time was a double click fired for the first time? If no double click was fired, print -1
instead.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
If at least one double click was fired, print the time of the first such event; otherwise, print -1
.
Sample Input 1
4 500
300 900 1300 1700
Sample Output 1
1300
Takahashi clicked the mouse at time and . Since , a double click was fired at time .
A double click had not been fired before time , so should be printed.
Sample Input 2
5 99
100 200 300 400 500
Sample Output 2
-1
No double click was fired, so print -1
.
Sample Input 3
4 500
100 600 1100 1600
Sample Output 3
600
If multiple double clicks were fired, be sure to print only the first such event.
update @ 2024/3/10 12:19:41