• + 0 comments

    include

    using namespace std;

    string gamingArray(vector arr) { int maxVal = INT_MIN; int moves = 0;

    for (int i = 0; i < arr.size(); i++) {
        if (arr[i] > maxVal) {
            maxVal = arr[i];
            moves++;
        }
    }
    // If number of moves is odd → Bob wins first move, Andy second, etc.
    return (moves % 2 == 0) ? "ANDY" : "BOB";
    

    }

    int main() { int g; cin >> g; while (g--) { int n; cin >> n; vector arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; cout << gamingArray(arr) << endl; } return 0; } Each time a player removes a “maximum element,” the rest of the array to its right disappears.

    The number of maximum updates (when a new max appears from left to right) equals the number of turns.

    If this count is odd, Bob (who starts first) makes the last move. If even, Andy wins.While you’re at it, check out the Geometry Dash Subzero new update — it’s a wild rhythm-run challenge that keeps your reflexes razor-sharp just like coding under pressure!