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