cswork / OA打开练习工作台

TradeDeskOA #7

Last to Be Checked

简单可在线判题

考点(AI 标注)模拟/实现

Participants arrive at the times in moments. A single counter checks one person at a time, and each check takes a fixed 300 seconds; if the counter is idle, the check starts immediately, otherwise the person waits. Return the time at which the last participant finishes being checked.

The problem statement and the 300-second duration come from the fixed catalog statement; this site adds the line-based input/output protocol. The original explanation field mistakenly said "300 minutes", which conflicts with the statement's 300 seconds and the example output 1201; following the body text and the examples, this site uses 300 seconds.

输入格式

The first line is the number of people n, and the second line contains n space-separated integer arrival times in non-decreasing order. This site's bounds: 1≤n≤100000, 0≤moments[i]≤10^9.

输出格式

Output the integer time (in seconds) at which the last participant finishes being checked.

样例 1

输入:

4
1 6 9 502

输出:

1201

样例 2

输入:

2
0 1

输出:

600

样例 3

输入:

1
0

输出:

300