結果

問題 No.61 リベリオン
ユーザー firiexpfiriexp
提出日時 2019-10-24 00:01:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,066 bytes
コンパイル時間 858 ms
コンパイル使用メモリ 94,064 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2024-04-27 15:24:58
合計ジャッジ時間 1,530 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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