Help me in solving PLPROCESS problem

My issue

I can’t undeerstand where is my 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

@pranto1610
The reinitialize the mn value with greater number greater than INT_MAX because according to the constraints the answer can reach upto 10^10 so its better to take 10^15 value in mn initially .

1 Like