結果

問題 No.849 yuki国の分割統治
ユーザー finefine
提出日時 2019-07-05 23:07:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,110 bytes
コンパイル時間 1,829 ms
コンパイル使用メモリ 169,200 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2024-04-16 08:02:53
合計ジャッジ時間 4,076 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 45 ms
6,944 KB
testcase_08 AC 54 ms
6,940 KB
testcase_09 AC 52 ms
6,940 KB
testcase_10 AC 49 ms
6,940 KB
testcase_11 AC 47 ms
6,940 KB
testcase_12 AC 46 ms
6,940 KB
testcase_13 AC 55 ms
6,944 KB
testcase_14 AC 54 ms
6,944 KB
testcase_15 AC 52 ms
6,940 KB
testcase_16 AC 72 ms
7,680 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 51 ms
6,940 KB
testcase_20 AC 66 ms
6,940 KB
testcase_21 AC 34 ms
6,940 KB
testcase_22 WA -
testcase_23 AC 64 ms
6,940 KB
testcase_24 AC 48 ms
6,940 KB
testcase_25 AC 78 ms
8,960 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll m = a * d - b * c;
    if (m == 0) {
        ll mx = __gcd(a, c);
        if (mx == 0) mx = 1e10;
        ll my = __gcd(b, d);
        if (my == 0) my = 1e10;
        set<P> s;
        int n;
        cin >> n;
        for (int i = 0; i < n; i++) {
            ll x, y;
            cin >> x >> y;
            s.emplace(x % mx, y % my);
        }
        cout << s.size() << "\n";
        return 0;
    }

    if (m < 0) {
        m = -m;
        a = (m - a % m) % m;
        b = (m - b % m) % m;
        c = (m - c % m) % m;
        d = (m - d % m) % m;
    }

    set<P> s;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        ll xx = (d * x % m + m - c * y % m) % m;
        ll yy = (a * y % m + m - b * x % m) % m;
        P tar(xx, yy);
        s.insert(tar);
    }

    cout << s.size() << "\n";
    return 0;
}
0