Logo
(追記) (追記ここまで)

33306번 - Coin Game 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
90 초 (추가 시간 없음) 2048 MB10000.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:

  1. $\alpha_1 = \sqrt{x^2 + y^2} + x^2 + A \cdot |x|$
  2. $\alpha_2 = \sqrt{x^2 + y^2} - x^2 - B \cdot |x|$
  3. $\alpha_3 = \sqrt{x^2 + y^2} + y^2 + C \cdot |y|$
  4. $\alpha_4 = \sqrt{x^2 + y^2} - y^2 - D \cdot |y|$

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:

  1. The first line contains three real numbers: $x,ドル $y,ドル and $a,ドル representing the coordinates of the coin and its orientation angle in radians. As usual, an angle of 0ドル$ corresponds to the positive direction of $Ox$ axis, an angle of $\pi/2$ means the positive direction of $Oy$ axis, and so on.
  2. The second line contains a single integer from 1ドル$ to 4ドル$: the number corresponding to the player's chosen angle of rotation.

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 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
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);
}

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 6: Nyatl’s Game Contest E번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 3이다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /