### Problem
Alice and Bob alternate taking the first 1,2,or 3 remaining stones, with Alice first. Each player adds the values taken to a score initially 0; stone values may be negative. All stones must eventually be taken. Assuming optimal play to maximize final score advantage, return "Alice","Bob",or "Tie" according to the final comparison.
```cpp
class Solution {
public:
string stoneGameIII(vector<int>& stoneValue);
};
```
### Examples
**Example 1:**
```text
Input: stoneValue = [2,2,2,7]
Output: "Bob"
Explanation: Taking three gives Alice6 and Bob7. Taking two lets Bob take the last two for9; taking one lets Bob take the remaining11. Alice's best option still loses.
```
**Example 2:**
```text
Input: stoneValue = [-1,-1]
Output: "Tie"
Explanation: Alice takes one-1 and Bob must take the other, tying at-1. Taking both would make Alice lose-2 to0.
```
### Constraints
- stoneValue has length 1 to 50000.
- Every stone value lies in `[-1000,1000]`.
### Contract considerations
Only the winner label is returned; the optimal move sequence need not be unique.
```hint Read the boundary condition
Both players respond optimally and all stones must be taken. Include negative values and each of the three possible result labels.
```
### Boundary reminders
Only the winner label is returned; the optimal move sequence need not be unique.
Overview: Winner of the Optimal One-to-Three Stone Game. Alice and Bob alternate taking the first1,2,or3 remaining stones, with Alice first.
Alice and Bob alternate taking the first 1,2,or 3 remaining stones, with Alice first. Each player adds the values taken to a score initially 0; stone values may be negative. All stones must eventually be taken. Assuming optimal play to maximize final score advantage, return "Alice","Bob",or "Tie" according to the final comparison.
class Solution {
public:
string stoneGameIII(vector<int>& stoneValue);
};
Examples
Example 1:
Input: stoneValue = [2,2,2,7]
Output: "Bob"
Explanation: Taking three gives Alice6 and Bob7. Taking two lets Bob take the last two for9; taking one lets Bob take the remaining11. Alice's best option still loses.
Example 2:
Input: stoneValue = [-1,-1]
Output: "Tie"
Explanation: Alice takes one-1 and Bob must take the other, tying at-1. Taking both would make Alice lose-2 to0.
Constraints
stoneValue has length 1 to 50000.
Every stone value lies in
[-1000,1000]
.
Contract considerations
Only the winner label is returned; the optimal move sequence need not be unique.
Boundary reminders
Only the winner label is returned; the optimal move sequence need not be unique.