#K94202. Average Bus Waiting Time

    ID: 38589 Type: Default 1000ms 256MiB

Average Bus Waiting Time

Average Bus Waiting Time

You are given a list of bus waiting times in minutes. Some waiting times may be negative, which indicate that the bus has already left. Your task is to compute the average waiting time, excluding negative values, using floor division. If all waiting times are negative, output -1.

Formally, let \(a_1, a_2, \dots, a_N\) be the waiting times. Define the set of non-negative waiting times as \(S = \{a_i \mid a_i \ge 0\}\). If \(|S| = 0\), then output \(-1\); otherwise, output \( \left\lfloor \frac{\sum_{x \in S} x}{|S|} \right\rfloor \).

inputFormat

The first line contains an integer \(N\) (\(1 \le N \le 10^5\)) representing the number of waiting times. The second line contains \(N\) space-separated integers, each representing a bus waiting time in minutes. Negative values indicate that the bus has already left.

outputFormat

Output a single integer representing the floor average of all non-negative waiting times. If there are no non-negative waiting times, output -1.

## sample
5
3 -1 5 7 0
3