code:-
#include
#include<limits.h>
using namespace std;
bool isPossible(int r[],int l,int p,int minimum){
int pratacooked=0;
int cookused=
for(int i=0;i<p;i++){
if(pratacooked+cookused>min){
cookused++;
if(cookused>l ){
return -1;
}
}
else{
pratacooked +=r[i];
}
}
}
int prata(int r[],int l,int p){
int s=0;
int e=p*(p+1)/2; //n(n+1)/2
int ans=INT_MAX;
while(s<=e){
int mid=(s+e)/2;
if(isPossible(r,l,p,mid)){
ans=min(ans,mid);
e=mid-1;
}
else{
s=mid+1;
}
}
return ans;
}
int main(){
int t;
cin>>t;
for(int i=0;i<t;i++){
int p;
cin>>p;
int l;
cin>>l;
int r[50];
for(int j=0;j<l;j++){
cin>>r[j];
}
}
}