n prizes, and each values them differently: prize i gives the first player first_values[i] points and the second player second_values[i] points. Both know both tables.
The players take turns picking one prize each, the first player starting, until no prizes are left. Each player scores the prizes they took by their own values.
Both play optimally. Return 1 if the first player ends with more points, -1 if the second player does, and 0 on a tie.first_values=[4, 1, 2], second_values=[1, 5, 3] → 1
The first player takes prize 1: it is worth only 1 to them, but that keeps it from the opponent, to whom it is worth 5. The second player takes prize 2 (3 points) and the first gets prize 0 (4 points). The score is 5 to 3.
first_values=[2, 3], second_values=[3, 2] → 0
Whatever the first player takes, both end up with 3 points: a draw.
first_values=[1, 1, 1], second_values=[6, 6, 6] → -1
first_values=[4, 1, 2], second_values=[1, 5, 3]
1
Run checks the first 3 tests in your browser. Submit checks all 106 tests on the server, hidden ones included.