結果
| 問題 |
No.62 リベリオン(Extra)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-18 07:25:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 937 bytes |
| コンパイル時間 | 852 ms |
| コンパイル使用メモリ | 103,040 KB |
| 最終ジャッジ日時 | 2025-01-29 09:06:07 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:5: error: ‘cin’ was not declared in this scope
7 | cin >> t;
| ^~~
main.cpp:2:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
1 | #include<atcoder/all>
+++ |+#include <iostream>
2 | using namespace std;
main.cpp:28:9: error: ‘cout’ was not declared in this scope
28 | cout << (ans ? "Hit" : "Miss") << '\n';
| ^~~~
main.cpp:28:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
ソースコード
#include<atcoder/all>
using namespace std;
using namespace atcoder;
int main(){
int t;
cin >> t;
while(t--){
long long W, H, D, Mx, My, Hx, Hy, Vx, Vy, g, gx, gy, Dx, Dy, mx, my;
cin >> W >> H >> D >> Mx >> My >> Hx >> Hy >> Vx >> Vy;
g = gcd(Vx, Vy);
Vx /= g, Vy /= g, D *= g;
gx = gcd(Vx, 2 * W), gy = gcd(Vy, 2 * H);
Vx /= gx, Dx = 2 * W / gx;
Vy /= gy, Dy = 2 * H / gy;
bool ans = false;
for(int i = 0; i < 4; i++){
mx = (i & 1? 1: -1) * Mx - Hx;
my = (i & 2? 1: -1) * My - Hy;
if(mx % gx != 0 || my % gy != 0)continue;
mx /= gx, my /= gy;
mx *= inv_mod(Vx, Dx);
my *= inv_mod(Vy, Dy);
auto T = crt({mx, my}, {Dx, Dy});
if(T.second == 0)continue;
if(T.first <= D)ans = true;
}
cout << (ans ? "Hit" : "Miss") << '\n';
}
}