Mock CCC '22 Contest 2 J3 - Figure Skating Fun

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Andrew has just finished judging the figure skating event! There were N competitors, and the ith one received a score of Si.

Since Andrew likes symmetry, he wants to find the spot to split the scores such that the sum of the scores on the left equals the sum of the scores on the right. Splitting between competitor M and competitor M+1 is defined as spot M. Help Andrew find this spot!

Constraints

1N106

1Si100

Subtask 1 [10/15]

1N104

Subtask 2 [5/15]

No additional constraints.

Input Specification

The first line contains one integer N, the number of competitors.

The second line contains N space-separated integers Si, the score of the ith competitor.

Output Specification

Output on a single line the spot M, or Andrew is sad. if it doesn't exist.

Sample Input 1

Copy
3
1 1 2

Sample Output 1

Copy
2

Explanation for Sample 1

Splitting between competitors 2 and 3, which is spot 2, yields the desired result: left of the spot sums to 1+1=2, while the right of the spot sums to 2.

Sample Input 2

Copy
3
1 1 1

Sample Output 2

Copy
Andrew is sad.

Comments

There are no comments at the moment.