None of the test case are passing

Why is the code giving wrong outputs?
#include<bits/stdc++.h>
using namespace std;
bool check(int l[],int n,int k,int min_time)
{
int curr_time=0,curr_painter=1;
for(int i=0;i<n;i++)
{
if(l[i]+curr_time >= min_time)
{
curr_time=l[i];
curr_painter++;
if(curr_painter>k)
return false;
}
else
curr_time+=l[i];
}
return true;
}
int main() {
int n,k,t,sum=0,ans=INT_MAX;
cin>>n>>k>>t;
int l[n];
for(int i=0;i<n;i++)
{
cin>>l[i];
sum+=l[i];
}
int s=l[n-1],e=sum;
while(s<=e)
{
int mid=(s+e)/2;
if(check(l,n,k,mid))
{
ans=min(ans,mid);
e=mid-1;
}
else
s=mid+1;
}
cout<<(ans*5)%1000003;
return 0;
}

hello @jha.aparna17
you were doing some things wrong like you were taking input any random variable ‘t’ which was disturbing the array input .you have to change your range as the range willl be from max element in the array to the sum of the array .
i have made all the necessary changes in your code and now it is passing all the test cases.
code link ->https://ide.codingblocks.com/s/318357.
Happy Learning !!

still none of the test case have passed

hello @jha.aparna17 i have made certain changes .
https://ide.codingblocks.com/s/318357.
please see the code here .

Happy Learning !!

now its working… thanks!