Maven Securities TechOA #1
Count Array Splits Where Left Sum Greater Than Right Sum
Estimated EasyJudge-ready
Topics (AI-labelled)Prefix & Ranges
Given an integer array, count the ways to cut it into two non-empty contiguous parts so that the sum of the left part is strictly greater than the sum of the right part.
Integer sums use arbitrary precision; the standard input/output protocol and the upper bound on n are explicitly supplied by this site.
This site adds a standard input/output protocol.
Input
The first line contains n (1 ≤ n ≤ 200000), and the second line contains n integers with absolute values at most 10^9.
Output
Output the number of qualifying cuts.
Example 1
Input:
5
-3 -2 1 -6 -30
Output:
4
Example 2
Input:
2
1 1
Output:
0
Example 3
Input:
3
-5 1 1
Output:
0
Editorial
Loading solution…