結果

問題 No.2355 Unhappy Back Dance
ユーザー 👑 nu50218nu50218
提出日時 2023-06-16 22:11:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,042 ms / 6,000 ms
コード長 1,341 bytes
コンパイル時間 3,168 ms
コンパイル使用メモリ 223,200 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 20:10:40
合計ジャッジ時間 16,896 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 17 ms
4,376 KB
testcase_07 AC 19 ms
4,380 KB
testcase_08 AC 66 ms
4,376 KB
testcase_09 AC 66 ms
4,380 KB
testcase_10 AC 219 ms
4,376 KB
testcase_11 AC 218 ms
4,376 KB
testcase_12 AC 67 ms
4,376 KB
testcase_13 AC 67 ms
4,380 KB
testcase_14 AC 257 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1,040 ms
4,380 KB
testcase_17 AC 1,035 ms
4,380 KB
testcase_18 AC 1,034 ms
4,380 KB
testcase_19 AC 1,042 ms
4,380 KB
testcase_20 AC 1,022 ms
4,376 KB
testcase_21 AC 423 ms
4,376 KB
testcase_22 AC 78 ms
4,376 KB
testcase_23 AC 82 ms
4,380 KB
testcase_24 AC 935 ms
4,376 KB
testcase_25 AC 499 ms
4,380 KB
testcase_26 AC 501 ms
4,376 KB
testcase_27 AC 428 ms
4,376 KB
testcase_28 AC 10 ms
4,376 KB
testcase_29 AC 24 ms
4,380 KB
testcase_30 AC 848 ms
4,380 KB
testcase_31 AC 614 ms
4,376 KB
testcase_32 AC 60 ms
4,376 KB
testcase_33 AC 346 ms
4,376 KB
testcase_34 AC 4 ms
4,376 KB
testcase_35 AC 11 ms
4,380 KB
testcase_36 AC 424 ms
4,376 KB
testcase_37 AC 225 ms
4,376 KB
testcase_38 AC 279 ms
4,380 KB
testcase_39 AC 220 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef LOCAL
#include <local.hpp>
#else
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2")
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#define postprocess(...) ((void)0)
#endif

using namespace std;
using ll = long long;
using ld = long double;

void solve([[maybe_unused]] int test) {
    int N;
    cin >> N;

    ll X[N], Y[N];
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
    }

    ll ans = 0;

    for (int i = 0; i < N; i++) {
        map<pair<ll, ll>, int> cnt;

        for (int j = 0; j < N; j++) {
            if (i == j) continue;

            ll dX = X[j] - X[i];
            ll dY = Y[j] - Y[i];

            if (dX != 0 && dY != 0) {
                ll div = gcd(abs(dX), abs(dY));
                dX /= div;
                dY /= div;
            } else {
                dX = (dX ? dX / abs(dX) : 0);
                dY = (dY ? dY / abs(dY) : 0);
            }

            cnt[{dX, dY}]++;
        }

        bool bad = false;
        for (auto&& [_, num] : cnt) {
            if (num > 1) bad = true;
        }
        if (bad) ans++;
    }

    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        solve(i);
    }

    postprocess();
}
0