結果

問題 No.61 リベリオン
ユーザー furafura
提出日時 2020-06-14 10:20:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 199,236 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 08:28:30
合計ジャッジ時間 2,956 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 180 ms
4,380 KB
testcase_04 AC 181 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0