結果

問題 No.1265 Balloon Survival
ユーザー milanis48663220milanis48663220
提出日時 2020-10-23 22:12:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 1,055 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 90,656 KB
実行使用メモリ 12,768 KB
最終ジャッジ日時 2023-09-28 16:00:10
合計ジャッジ時間 3,132 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 9 ms
4,376 KB
testcase_15 AC 7 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 37 ms
12,408 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 9 ms
4,376 KB
testcase_21 AC 18 ms
5,372 KB
testcase_22 AC 12 ms
5,108 KB
testcase_23 AC 13 ms
5,112 KB
testcase_24 AC 65 ms
12,768 KB
testcase_25 AC 65 ms
12,112 KB
testcase_26 AC 66 ms
12,408 KB
testcase_27 AC 66 ms
12,236 KB
testcase_28 AC 66 ms
12,088 KB
testcase_29 AC 66 ms
11,688 KB
testcase_30 AC 66 ms
12,240 KB
testcase_31 AC 63 ms
11,612 KB
testcase_32 AC 65 ms
12,216 KB
testcase_33 AC 65 ms
11,748 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> P_;
typedef pair<ll, P_> P;

int n;
ll x[1000], y[1000];
bool del[1000];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
    vector<P> v;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            ll m = (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]);
            v.push_back(P(m, P_(i, j)));
        }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for(auto p : v){
        int i = p.second.first;
        int j = p.second.second;
        // cout << i << ' ' << j << endl;
        if(i == 0 && !del[j]){
            ans++;
            del[j] = true;
        }else{
            if((!del[i]) && (!del[j])){
                del[i] = true; del[j] = true;
            }
        }
    }
    cout << ans << endl;
}
0