Please tell me what's wrong in this code?

#include <iostream>

int main() {
    int t = 0;
    long int N = 0, currentSum = 0, maxSum = 0, maxSumArray[100000] = {0},
             A[100000][20] = {0};
    std::cin >> N;
    for (int i = 0; i < N; ++i) {
        std::cin >> t;
        for (int j = 0; j < t; ++j) {
            std::cin >> A[i][j];
            if (A[i][j] > 0 || currentSum != 0) {
                currentSum += A[i][j];
                if (currentSum >= maxSum) maxSum = currentSum;
                if (currentSum < 0) break;
            }
        }
        maxSumArray[i] = maxSum;
    }
    for (int i = 0; i < N; ++i) std::cout << maxSumArray[i] << '\n';
    return 0;
}

Hello @moon i am not even able to get your logic.
why are you making the 2d array this is the 1d array question.
you can do this in best complexity with Kadane’s algorithm.
Here for your reference i am attaching the code:
https://ide.codingblocks.com/s/395419
if you have any doubt you can ask here:
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.