AliceGame
SRM 639 · 2014-08-25 · by dreamoon
Problem Statement
Alice and Kirito just played a game. The game consisted of a finite (possibly empty) sequence of turns. You do not know the exact number of turns. The turns were numbered starting from 1. In each turn, exactly one of our two players won. The winner of turn i scored 2*i-1 points.
You are given two
Constraints
- x and y are between 0 and 1,000,000,000,000, inclusive.
8 17 Returns: 2
This final result is possible. Alice must have won at least two turns. One possibility is that Alice won turns 2 and 3 (for 3+5 = 8 points) and Kirito won turns 1, 4, and 5 (for 1+7+9 = 17 points).
17 8 Returns: 3
0 0 Returns: 0
9 9 Returns: -1
500000 500000 Returns: 294
Submissions are judged against all 89 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class AliceGame with a public method long long findMinimumValue(long long x, long long y) · 89 test cases · 2 s / 256 MB per case