結果
| 問題 |
No.61 リベリオン
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2022-12-20 18:16:45 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 140 ms / 5,000 ms |
| コード長 | 1,035 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 142,960 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-18 01:57:50 |
| 合計ジャッジ時間 | 1,505 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
using namespace std;
int main(){
long long Q, W, H, D, mx, my, hx, hy, vx, vy, t, X, Y;
cin >> Q;
while(Q){
cin >> W >> H >> D >> mx >> my >> hx >> hy >> vx >> vy;
long long g;
if (vx == 0) g = abs(vy);
else if (vy == 0) g = abs(vx);
else g = gcd(vx, vy);
D *= g;
t = min(D+1, 1025LL);
vx /= g;
vy /= g;
bool f=1;
for (int i=0; i<t; i++){
X = ((hx+vx*i) % (W*2)+W*2) % (W*2);
Y = ((hy+vy*i) % (H*2)+H*2) % (H*2);
if (X > W) X = W * 2 - X;
if (Y > H) Y = H * 2 - Y;
if (mx == X && my == Y){
cout << "Hit" << endl;
f = 0;
break;
}
}
if (f) cout << "Miss" << endl;
Q--;
}
return 0;
}
srjywrdnprkt