My issue
I can’t undeerstand where is my wrong…! …what’s wrong?
My code
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
// your code goes here //prefix sum...............!!
ll int t;
cin>>t;
while(t--)
{
ll int n;
cin>>n;
ll int *a=new ll int[n];
for(ll int i=0;i<n;i++)
cin>>a[i];
for(ll int i=1;i<n;i++)
a[i]+=a[i-1];
ll int mx=INT_MIN,mn=INT_MAX;
for(ll int i=0;i<n;i++)
{
mx=max(a[i], a[n-1]-a[i]);
mn=min(mn, mx);
}
std::cout << mn << std::endl;
}
return 0;
}
Problem Link: PLPROCESS Problem - CodeChef