Help me in solving PLPROCESS problem

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

@pranto1610
By making mn as INT_MAX u are saying the answer would be surely lesser than INT_MAX but it can be greater than INT_MAX so just assign mn with more greater value like 1e15 .

1 Like