結果

問題 No.2355 Unhappy Back Dance
ユーザー coindarwcoindarw
提出日時 2023-06-16 22:08:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,068 ms / 6,000 ms
コード長 2,401 bytes
コンパイル時間 4,510 ms
コンパイル使用メモリ 272,348 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 20:06:17
合計ジャッジ時間 19,416 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 58 ms
4,376 KB
testcase_07 AC 57 ms
4,380 KB
testcase_08 AC 106 ms
4,376 KB
testcase_09 AC 104 ms
4,376 KB
testcase_10 AC 291 ms
4,376 KB
testcase_11 AC 281 ms
4,376 KB
testcase_12 AC 103 ms
4,380 KB
testcase_13 AC 101 ms
4,376 KB
testcase_14 AC 348 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1,068 ms
4,376 KB
testcase_17 AC 1,060 ms
4,376 KB
testcase_18 AC 1,051 ms
4,376 KB
testcase_19 AC 1,060 ms
4,380 KB
testcase_20 AC 1,058 ms
4,376 KB
testcase_21 AC 434 ms
4,376 KB
testcase_22 AC 78 ms
4,380 KB
testcase_23 AC 83 ms
4,380 KB
testcase_24 AC 961 ms
4,376 KB
testcase_25 AC 517 ms
4,380 KB
testcase_26 AC 514 ms
4,376 KB
testcase_27 AC 446 ms
4,376 KB
testcase_28 AC 10 ms
4,376 KB
testcase_29 AC 23 ms
4,380 KB
testcase_30 AC 888 ms
4,380 KB
testcase_31 AC 651 ms
4,380 KB
testcase_32 AC 59 ms
4,376 KB
testcase_33 AC 359 ms
4,380 KB
testcase_34 AC 4 ms
4,376 KB
testcase_35 AC 11 ms
4,376 KB
testcase_36 AC 441 ms
4,380 KB
testcase_37 AC 239 ms
4,376 KB
testcase_38 AC 297 ms
4,380 KB
testcase_39 AC 229 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using ll = long long;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); ++i)
constexpr int inf = 2000'000'000;
constexpr ll linf = 4000000000000000000ll;
constexpr ll M7 = 1000000007ll;
constexpr ll M09 = 1000000009ll;
constexpr ll M9 = 998244353ll;
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
using namespace std;
using namespace atcoder;
template <typename T>
inline ostream& operator<<(ostream& os, vector<T>& v) {
    for (auto& e : v) os << e << " ";
    return os;
}
template <typename T, typename U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) noexcept {
    return os << "(" << p.first << ", " << p.second << ")";
}
#ifdef ONLINE_JUDGE
#define debug(...)
#else
#define debug(...) cerr << "<" << #__VA_ARGS__ << ">: ", debug_out(__VA_ARGS__)
template <typename T>
void debug_out(T t) {
    cerr << t << endl;
}
template <typename T, typename... Args>
void debug_out(T t, Args... args) {
    cerr << t << ", ";
    debug_out(args...);
}
#endif

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    using P = pair<ll, ll>;
    vector<P> v(n);
    rep(i, n) cin >> v[i].first >> v[i].second;
    ll ans = 0;
    rep(i, n) {
        auto [x, y] = v[i];
        auto cv = v;
        cv.erase(cv.begin() + i);
        sort(all(cv), [&](const auto& a, const auto& b) {
            auto [ax, ay] = a;
            auto [bx, by] = b;
            ax -= x;
            ay -= y;
            bx -= x;
            by -= y;
            return ax * by - ay * bx > 0;
        });
        map<P, int> mp;
        for (auto [cx, cy] : cv) {
            cx -= x;
            cy -= y;
            ll g = gcd(cx, cy);
            cx /= g;
            cy /= g;
            if (g < 0) {
                cx *= -1;
                cy *= -1;
            }
            mp[{cx, cy}]++;
        }
        ll cnt = 0;
        for (auto [k, v] : mp) {
            cnt = max(cnt, (ll)v);
        }
        ans += cnt >= 2;
    }
    cout << ans << endl;
    return 0;
}
0