結果
| 問題 |
No.61 リベリオン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-14 10:20:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 220 ms / 5,000 ms |
| コード長 | 572 bytes |
| コンパイル時間 | 4,135 ms |
| コンパイル使用メモリ | 192,272 KB |
| 最終ジャッジ日時 | 2025-01-11 04:13:17 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
int q; cin>>q;
rep(_,q){
int w,h,d,sx,sy,gx,gy,vx,vy;
cin>>w>>h>>d>>gx>>gy>>sx>>sy>>vx>>vy;
int g=gcd(vx,vy);
d*=g;
int dx=vx/g;
int dy=vy/g;
bool vis[30][30]={};
int x=sx,y=sy;
rep(t,min(d+1,1200)){
vis[y][x]=true;
y=(y+dy)%(2*h); if(y<0) y+=2*h;
x=(x+dx)%(2*w); if(x<0) x+=2*w;
}
puts(vis[gy][gx]
||vis[gy][(2*w-gx)%(2*w)]
||vis[(2*h-gy)%(2*h)][gx]
||vis[(2*h-gy)%(2*h)][(2*w-gx)%(2*w)]?"Hit":"Miss");
}
return 0;
}