Here is the code.last 2 test cases coudn't satisfy

#include<bits/stdc++.h>
using namespace std;
#define ll long long int

bool check(ll k,ll a[],ll n,ll time)
{
ll count=1;
ll sum=0;
for(int i=0;i<n;i++)
{
if(a[i]>time)
{
return false;
}

	if(sum+a[i]<=time)
	{
		sum+=a[i];
	}
	else
	{
		count++;
		sum=a[i];
		if(count>k)
			return false;
	}
}
return true;

}
int main()
{
ll k,n,t;
cin >> k >> n;
cin >> t;
ll a[n];
for(ll i=0;i<n;i++)
cin >> a[i];
ll l;
ll max=a[0];
ll sum=0;
for(ll i=0;i<n;i++)
{
sum+=a[i];
if(a[i] > max)
max=a[i];
}
l=max;
ll r=sum;
ll ans=0;
while(l<=r)
{
ll mid=(l+r)/2;
if(check(k,a,n,mid))
{
ans=mid;
r=mid-1;
}
else
{
l=mid+1;
}
}

   cout<<((ans%10000003)*t)%10000003<<endl;  

}

please send the link of code

how to send Link of Code ?

paste you code at

click on file->save->link will be generated
send the link of code generated
it will look like https://ide.codingblocks.com/s/258793

sent you the link can you please check now??

Modified Code

Input Format

First line contains three space seperated integers N,K and T ,where
N = Size of array,
K = No of painters available ,
T = Time taken to print each board by one painter
Next line contains N space seperated positive integers denoting size of N boards.

first you have to take n and then k

also make one change
ans=((ans%10000003)*t)%10000003;

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning: