| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 90 초 (추가 시간 없음) | 2048 MB | 10 | 0 | 0 | 0.000% |
Now it's time to play a real game! But, I don't have anything but just one little coin. So, let's do something fun with it!
This isn't just any ordinary coin; it bears a unique image allowing me to interpret its rotational angle with remarkable ease. By selecting a specific point on this coin's face, I can draw an arrow from the center to that point. Intrigued? I thought you would be! Let's set the stage for our game.
Imagine this: I place the coin right at the origin on a two-dimensional coordinate plane, poised to face along the positive $Oy$ axis. The game is turn-based. On each turn, the active player will rotate the coin by one of the four predetermined angles, then advance it by 1 unit in the direction defined by the arrow.
The game lasts for 500ドル$ full moves (500ドル$ turns for one player and 500ドル$ for the other). After all moves, you win if the $x$ coordinate of the coin is negative, and I win otherwise.
The rotation options available depend on the current coordinates of the coin $(x, y)$ and are computed with the following formulas:
Here, $A,ドル $B,ドル $C,ドル and $D$ are some constants established before the game begins.
Excited yet? What's that? You're unsure about how to conquer this challenge? You think just because I conceived this game, I have all the strategies figured out? Fear not! I'll grant you a small advantage: I'll make my moves in the blink of an eye.
At the beginning, the jury's program prints a line with a single integer $t$ (1ドル \le t \le 40$): the number of games.
Each game, the jury starts by providing a line that contains the four constants: $A,ドル $B,ドル $C,ドル and $D$. Each of these coefficients is an integer ranging from 1ドル$ to 100ドル$.
Then the game proceeds: first, the jury's turn, then the participant's, and so on. Each turn is described on two lines. The first line is always printed by the jury. The second line is printed by the current player (jury or participant). These lines' contents are as follows:
Each game lasts for 500ドル$ full moves (500ドル$ jury's turns and 500ドル$ participant's turns). If after all moves, the $x$ coordinate of the coin is negative, the participant wins. Otherwise, the jury wins.
There are two tests. The first test is the sample test, where $t = 1$ and the jury's program will make random moves. The test is considered passed for any valid output, regardless of the final position of the coin. In the second test $t = 40$. You should win at least 36ドル$ out of 40ドル$ games.
The jury's program outputs floating-point numbers with a precision of 18ドル$ decimal places (trailing zeros can be omitted). The jury's program calculates each move in approximately 0ドル.5$ milliseconds!
1 1 1 1 1 0.00 0.00 1.57 1 0.00 1.00 1.57 -0.84 1.54 2.57 1 0.08 1.14 5.88 0.76 1.88 0.82 2 0.82 2.88 1.51 -0.18 3.00 3.02 1 0.82 2.94 6.22 0.37 3.84 2.04 4 1.37 3.74 -0.10
1 1 2 3 3
The example is provided to demonstrate the format of input and output. In the actual validation of the solution, players will make 500ドル$ moves and the jury's program will output all numbers with a precision of 18ドル$ decimal places.
To avoid precision issues, you may use the coin-moving function from the jury's program:
double pi = acos(-1.);
void rotate_and_move(double &x, double &y, double &a, int type) {
double diff = 0;
double s = sqrt(x * x + y * y);
if (type == 1) diff = s + x * x + A * fabs(x);
if (type == 2) diff = s - x * x - B * fabs(x);
if (type == 3) diff = s + y * y + C * fabs(y);
if (type == 4) diff = s - y * y - D * fabs(y);
a += diff;
a = fmod(a, 2 * pi);
x += cos(a);
y += sin(a);
}