問題一覧 > 通常問題

No.61 Rebellion

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 81
作問者 : kroton
お気に入りにしたユーザー ProblemId : 113 / 自分の提出
問題文最終更新日: 2026-06-26 23:14:01
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 49 (順位表) の他の問題:

Problem Statement

Two magical girls, Mami and Homura, were engaged in a gunfight in a sealed room of width \(W\) meters and depth \(H\) meters.

Homura stopped time and, at the same moment, fired her last bullet.
In the world of stopped time, only Homura and the bullet can move. When the bullet hits a wall, it reflects at an angle equal to the angle of incidence and keeps flying forever without losing speed.

Let \((Mx, My)\) be the position of Mami, \((Hx, Hy)\) be the position from which Homura fired, and \((Vx, Vy)\) be the velocity vector of the bullet when fired. When time is stopped for \(D\) seconds,
determine whether the bullet can hit Mami within \(D\) seconds.

Here, the sizes of Mami and the bullet are negligible, and Homura is never hit by the bullet.


Figure: Example of a placement

Input

\(Q\)
\(W_{1}\) \(H_{1}\) \(D_{1}\) \(Mx_{1}\) \(My_{1}\) \(Hx_{1}\) \(Hy_{1}\) \(Vx_{1}\) \(Vy_{1}\)
\(W_{2}\) \(H_{2}\) \(D_{2}\) \(Mx_{2}\) \(My_{2}\) \(Hx_{2}\) \(Hy_{2}\) \(Vx_{2}\) \(Vy_{2}\)
\(\ldots\)
\(W_{Q}\) \(H_{Q}\) \(D_{Q}\) \(Mx_{Q}\) \(My_{Q}\) \(Hx_{Q}\) \(Hy_{Q}\) \(Vx_{Q}\) \(Vy_{Q}\)

All input values are integers.

  • \(1 \leq Q \leq 10000\) is the number of test cases.
  • The \(Q\) lines starting from the second line each give a tuple \(W, H, D, Mx, My, Hx, Hy, Vx, Vy\).
  • \(2\leq W, H\leq 15\)
  • \(1 \leq D \leq 10^8\)
  • \(0 < Mx, Hx < W\)
  • \(0 < My, Hy < H\)
  • \(-15 \leq Vx, Vy \leq 15\)
  • \((Mx, My) \neq (Hx, Hy)\) is guaranteed.
  • \((Vx, Vy) \neq (0, 0)\) is guaranteed.

Output

For each test case, print "Hit" if the bullet hits Mami, and "Miss" otherwise. Print a newline at the end.

Sample

Sample 1
Input
5
9 9 74 7 6 4 1 -5 2
7 11 30 5 4 5 10 13 8
15 4 17 10 3 12 3 -3 1
3 9 22 2 2 1 1 13 12
8 11 2 6 5 1 9 -2 -4
Output
Miss
Hit
Miss
Miss
Miss
Sample 2
Input
5
2 15 19 1 2 1 4 1 5
5 5 11 3 1 4 2 9 -7
13 6 68 8 2 11 2 -13 0
2 15 90 1 2 1 8 0 -7
11 4 77 9 1 10 1 -6 13
Output
Miss
Miss
Hit
Hit
Miss

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。