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