962A.md (1646B)
1 Source: https://codeforces.com/problemset/problem/962/A 2 3 A. Equator 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Polycarp has created his own training plan to prepare for the programming contests. He will train for $n$ days, all days are numbered from $1$ to $n$, beginning from the first. 22 23 On the $i$-th day Polycarp will necessarily solve $a_i$ problems. One evening Polycarp plans to celebrate the equator. He will celebrate it on the first evening of such a day that from the beginning of the training and to this day inclusive he will solve half or more of all the problems. 24 25 Determine the index of day when Polycarp will celebrate the equator. 26 27 Input 28 29 The first line contains a single integer $n$ ($1 \le n \le 200\,000$) — the number of days to prepare for the programming contests. 30 31 The second line contains a sequence $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10\,000$), where $a_i$ equals to the number of problems, which Polycarp will solve on the $i$-th day. 32 33 Output 34 35 Print the index of the day when Polycarp will celebrate the equator. 36 37 Examples 38 39 Input 40 41 ``` 42 4 43 1 3 2 1 44 ``` 45 46 Output 47 48 ``` 49 2 50 ``` 51 52 Input 53 54 ``` 55 6 56 2 2 2 2 2 2 57 ``` 58 59 Output 60 61 ``` 62 3 63 ``` 64 65 Note 66 67 In the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $4$ out of $7$ scheduled problems on four days of the training. 68 69 In the second example Polycarp will celebrate the equator on the evening of the third day, because up to this day (inclusive) he will solve $6$ out of $12$ scheduled problems on six days of the training.