4 test cases not passed

my code;-
#include
using namespace std;
bool check(long long int boards[],long long int n,long long int k,long long int t,long long int mintym){
long long int painter=1;
long long int boardsused=0;
for(int i=0;i<n;i++){
if(boardsused+boards[i]>mintym){
painter++;
boardsused=boards[i];
if(painter>k){
return false;
}
}
else{
boardsused +=boards[i];
}
}
return true;
}
long long int mintime(long long int boards[],long long int n,long long int k,long long int t){
long long int sum=0;
for(int i=0;i<n;i++){
sum +=boards[i];
}
long long int s=boards[n-1];
long long int e=sum;
long long int ans=0;
while(s<=e){
long long int mid=(s+e)/2;
if(check(boards,n,k,t,mid)){
ans=mid;
e=mid -1;
}
else{
s=mid+1;
}
}
ans=ans % 10000003;
return ans;
}
int main(){
long long int n; //no of boards
cin>>n;
long long int k; //no of painters
cin>>k;
long long int t; //time taken to print each board by one painter
cin>>t;
long long int boards[100000];
for(int i=0;i<n;i++){
cin>>boards[i];
}
cout<<(mintime(boards,n,k,t)*t) % 10000003<<endl;
}

hi @anshita_1312 updated https://ide.codingblocks.com/s/667054

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.