結果

問題 No.1265 Balloon Survival
ユーザー zuminzumin
提出日時 2021-03-28 16:24:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 859 bytes
コンパイル時間 851 ms
コンパイル使用メモリ 90,284 KB
実行使用メモリ 17,336 KB
最終ジャッジ日時 2023-08-19 15:37:46
合計ジャッジ時間 3,444 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 13 ms
4,788 KB
testcase_15 AC 10 ms
4,792 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 60 ms
15,924 KB
testcase_18 AC 6 ms
4,376 KB
testcase_19 AC 5 ms
4,380 KB
testcase_20 AC 13 ms
4,664 KB
testcase_21 AC 28 ms
6,160 KB
testcase_22 AC 18 ms
6,300 KB
testcase_23 AC 19 ms
6,496 KB
testcase_24 AC 115 ms
16,056 KB
testcase_25 AC 115 ms
15,988 KB
testcase_26 AC 116 ms
16,652 KB
testcase_27 AC 114 ms
15,704 KB
testcase_28 AC 115 ms
16,244 KB
testcase_29 AC 115 ms
16,052 KB
testcase_30 AC 117 ms
17,336 KB
testcase_31 AC 114 ms
15,684 KB
testcase_32 AC 116 ms
15,800 KB
testcase_33 AC 114 ms
16,460 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <tuple>

using namespace std;
using ll=long long;

int main(){
    ll n,ans=0;
    cin>>n;
    vector<ll> x(n),y(n),kil(n,0);
    priority_queue<tuple<ll,ll,ll>,vector<tuple<ll,ll,ll>>,greater<tuple<ll,ll,ll>>> q;

    for(ll i=0;i<n;i++) cin>>x[i]>>y[i];
    
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
            ll xi,yi,xj,yj;
            xi=x[i],yi=y[i],xj=x[j],yj=y[j];
            q.push(make_tuple(pow(xi-xj,2)+pow(yi-yj,2),i,j));
        }
    }
    while(q.size()){
        ll d,i,j;
        tie(d,i,j)=q.top();q.pop();
        if(kil[i]||kil[j]) continue;
        if(i!=0&&j!=0){
            kil[i]=1;
            kil[j]=1;
        }else{
            kil[j]=1;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}
0