結果

問題 No.1265 Balloon Survival
ユーザー mmn15277198mmn15277198
提出日時 2020-11-17 14:56:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,459 bytes
コンパイル時間 1,016 ms
コンパイル使用メモリ 102,528 KB
実行使用メモリ 13,012 KB
最終ジャッジ日時 2023-09-30 14:14:06
合計ジャッジ時間 3,057 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 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 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 7 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 38 ms
12,332 KB
testcase_18 WA -
testcase_19 AC 4 ms
4,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 13 ms
5,140 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>
#include<set>

#define rep(i,n) for(int (i) = 0; i < (n); i++)

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

//const ll mod = 1e9 + 7;
const ll mod = 998244353;
const int inf = 123456;
const int siz = 202020;

ll dist(int a , int b , int c , int d){
    return (a - b)*(a - b) + (c - d)*(c - d);
}

int main() {
        int n;
        cin >> n;
        vector<int> x(n) , y(n);
        for(int i = 0; i < n; i++){
            cin >> x[i] >> y[i];
        }
        vector<pair<ll , pair<int , int> > > v;
        for(int i = 0; i < n - 1; i++){
            for(int j = i + 1; j < n; j++){
                ll d = dist(x[i] , x[j] , y[i] , y[j]);
                v.push_back(make_pair(d , make_pair(i , j)));
            }
        }
        sort(v.begin() , v.end());
        vector<bool> used(n + 100 , false);
        int ans = 0;
        for(int i = 0; i < v.size(); i++){
            int x = v[i].second.first;
            int y = v[i].second.second;
            if(used[x] == false && used[y] == false){
            	if(x == 0){
            		ans++;
            		used[y] = true;
            	}else{
            		used[x] = used[y] = true;
            	}
            }
        }
        cout << ans << endl;
    return 0;
}
0