MAXSUMSQ - Maximum Sum Sequences
Given an array A having n elements, let X be the maximum sum of any contiguous sequence in the array. How many contiguous sequences in A sum up to X?
The first line contains T the number of test cases. There follow 2T lines, 2 for each test case. The first line contains the n, the number of elements in the array. The second line contains n space separated integers Ai.
Output T lines, one for each test case. On each line, output two space separated integers; the maximum sequence sum, and the number of sequences which obtain this maximum sum.
-1 -1 -1
2 0 -2 2 Output: -1 3
1 <= T <= 35
1 <= n <= 100000
-1000 <= Ai <= 1000
AC with map easilyLast edit: 2023-03-12 05:08:51
did it with BIT
Can anyone have a look at my code for this problem and tell what is wrong??
use kadane's algo along with count array
Finally AC after 4 WA and 2 TLE.
accepted using scanf and printf
map -> TLE
Use long long for "the number of sequences which obtains this maximum sum".
@reddragon the first element only, the first and the second, the last element only, the whole array