結果
| 問題 | No.61 リベリオン | 
| コンテスト | |
| ユーザー |  FF256grhy | 
| 提出日時 | 2018-01-02 00:30:10 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 61 ms / 5,000 ms | 
| コード長 | 2,773 bytes | 
| コンパイル時間 | 1,406 ms | 
| コンパイル使用メモリ | 167,084 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-13 16:15:38 | 
| 合計ジャッジ時間 | 2,003 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 4 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)
template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
// ---- ----
template<typename T> T mod(T x, T y) { return (x % y + y) % y; }
template<typename T> void setmod(T & x, T y) { x = mod(x, y); }
int main() {
	int q;
	cin >> q;
	inc(qq, q) {
		LL w, h, d, mx, my, hx, hy, vx, vy;
		cin >> w >> h >> d >> mx >> my >> hx >> hy >> vx >> vy;
		
		int f[30][30];
		inc(i, 30) {
		inc(j, 30) {
			f[i][j] = 0;
		}
		}
		
		LL dd = abs(gcd(vx, vy));
		d  *= dd;
		vx /= dd;
		vy /= dd;
		//cout << "d: " << d << endl;
		//cout << "v: " << vx << " " << vy << endl;
		f[hx][hy] = 1;
		inc(i, d) {
			// cout << hx << " " << hy << endl;
			
			hx += vx; setmod(hx, w * 2);
			hy += vy; setmod(hy, h * 2);
			// (hx += vx) %= w * 2;
			// (hy += vy) %= h * 2;
			if(! setmax(f[hx][hy], 1)) { break; }
		}
		
		int g = 0;
		setmax(g, f[        mx][        my]);
		setmax(g, f[w * 2 - mx][        my]);
		setmax(g, f[        mx][h * 2 - my]);
		setmax(g, f[w * 2 - mx][h * 2 - my]);
		
		cout << (g == 0 ? "Miss" : "Hit") << "\n";
		
		
		f[        mx][        my] += 2;
		f[w * 2 - mx][        my] += 2;
		f[        mx][h * 2 - my] += 2;
		f[w * 2 - mx][h * 2 - my] += 2;
		string s = ".aO@";
		
		/*
		dec(y, h * 2) {
		inc(x, w * 2) {
			cout << s[f[x][y]] << " ";
		} cout << endl;
		} cout << endl;
		*/
	}
	
	return 0;
}
            
            
            
        