結果

問題 No.1265 Balloon Survival
ユーザー Fu_LFu_L
提出日時 2024-03-02 14:09:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 2,566 ms
コンパイル使用メモリ 213,344 KB
実行使用メモリ 16,232 KB
最終ジャッジ日時 2024-03-02 14:10:04
合計ジャッジ時間 5,423 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 10 ms
6,676 KB
testcase_15 AC 8 ms
6,676 KB
testcase_16 AC 4 ms
6,676 KB
testcase_17 AC 40 ms
16,228 KB
testcase_18 AC 6 ms
6,676 KB
testcase_19 AC 4 ms
6,676 KB
testcase_20 AC 10 ms
6,676 KB
testcase_21 AC 19 ms
7,408 KB
testcase_22 AC 13 ms
7,404 KB
testcase_23 AC 14 ms
7,404 KB
testcase_24 AC 69 ms
16,232 KB
testcase_25 AC 70 ms
16,232 KB
testcase_26 AC 70 ms
16,232 KB
testcase_27 AC 70 ms
16,232 KB
testcase_28 AC 69 ms
16,232 KB
testcase_29 AC 69 ms
16,232 KB
testcase_30 AC 69 ms
16,232 KB
testcase_31 AC 68 ms
16,232 KB
testcase_32 AC 69 ms
16,232 KB
testcase_33 AC 70 ms
16,232 KB
testcase_34 AC 2 ms
6,676 KB
testcase_35 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, a, b) for(ll i = a; i < b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)
constexpr ll inf = 4e18;
struct SetupIO {
    SetupIO() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout << fixed << setprecision(30);
    }
} setup_io;
int main(void) {
    int n;
    cin >> n;
    vector<ll> x(n), y(n);
    rep(i, 0, n) {
        cin >> x[i] >> y[i];
    }
    vector<pair<ll, P>> v;
    rep(i, 0, n) {
        rep(j, i + 1, n) {
            v.push_back({(x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]), {i, j}});
        }
    }
    sort(v.begin(), v.end());
    vector<bool> flag(n);
    ll ans = 0;
    for(const auto& p : v) {
        if(flag[p.second.first] or flag[p.second.second]) continue;
        if(p.second.first == 0) {
            ans++;
        } else {
            flag[p.second.first] = true;
        }
        flag[p.second.second] = true;
    }
    cout << ans << '\n';
}
0