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;
	    ll int n;
	    ll int *a=new ll int[n];
	    for(ll int i=0;i<n;i++)
	 for(ll int i=1;i<n;i++)
	 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

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