結果
| 問題 | No.61 リベリオン | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-10-24 00:01:41 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,066 bytes | 
| コンパイル時間 | 1,007 ms | 
| コンパイル使用メモリ | 95,500 KB | 
| 実行使用メモリ | 6,816 KB | 
| 最終ジャッジ日時 | 2024-11-15 18:47:31 | 
| 合計ジャッジ時間 | 1,384 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 3 WA * 1 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <limits>
static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
int main() {
    int q;
    cin >> q;
    while(q--){
        int w, h, d, mx, my ,hx, hy, vx, vy;
        cin >> w >> h >> d >> mx >> my >> hx >> hy >> vx >> vy;
        int g = abs(__gcd(vx, vy));
        d *= g;
        vx /= g; vy /= g;
        int x = hx, y = hy;
        int ok = 0;
        for (int i = 0; i <= min(d, 1050); ++i) {
            int xx = abs(x+vx), yy = abs(y+vy);
            xx %= 2*w; yy %= 2*h;
            if(xx > w) xx = 2*w - xx;
            if(yy > h) yy = 2*h - yy;
            x += vx; y += vy;
            if(xx == mx && yy == my){
                ok = 1;
                break;
            }
        }
        puts(ok ? "Hit" : "Miss");
    }
    return 0;
}
            
            
            
        