int solve(int ind ,pair<int,int> alphaBeta, vector<int>& stoneValue, bool isAlice ,pair<int,int> points ={0,0}){
if(ind >= stoneValue.size()){
if(points.first == points.second)
return 0;
return points.first > points.second ? 1 : -1;
}
if(isAlice){
int maxi = INT_MIN;
int score = points.first;
for(int i = ind; i < ind+3 && i < stoneValue.size(); i++){
score += stoneValue[i];
int eva = solve(i+1,alphaBeta,stoneValue, !isAlice,{score, points.second});
maxi = max(maxi, eva);
alphaBeta.first = max(alphaBeta.first, maxi);
if(alphaBeta.second <= alphaBeta.first)
break;
}
return maxi;
}
else{
int mini = INT_MAX;
int score = points.second;
for(int i = ind; i < ind+3 && i < stoneValue.size(); i++){
score += stoneValue[i];
int eva = solve(i+1,alphaBeta,stoneValue, !isAlice,{points.first, score});
mini = min(mini, eva);
alphaBeta.second = min(mini, alphaBeta.second);
if(alphaBeta.second <= alphaBeta.first)
break;
}
return mini;
}
}