Painter Problem.Can u plz tell me what's wrong in my code

#include
#include
using namespace std;

bool isPossible(int *A,int N,int K,int T,int current)
{
int painters=1;
int painted_boards=0;
for(int i=0;i<N;i++)
{
if((painted_boards+A[i])*current>T)
{
painters++;
painted_boards=A[i];
if(painters>K)
return false;
}
else
{
painted_boards=painted_boards+A[i];
}
}
return true;
}

int main() {

int N,K,T;
cin>>N>>K>>T;
int current=T;
int *A=new int[N];
for(int i=0;i<N;i++)
   cin>>A[i];
  
int sum=0;
for(int i=0;i<N;i++)
   sum=sum+A[i];
int Max_Time=sum*T;

int l=1*T;
int h=Max_Time;
int mid=0;
int ans=0;

while(l<=h)
{
	mid=(l+h)/2;
	if(isPossible(A,N,K,mid,current))
	{
		ans=mid;
		l=mid+1;
	}
	else
	    h=mid-1;
} 
cout<<ans;

}

@Mukul-Shane-1247687648773500,
refer this : https://ide.codingblocks.com/s/656045

@Mukul-Shane-1247687648773500,
check your code ive commented https://ide.codingblocks.com/s/656050

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.