[Offer收割]编程练习赛32 register

Ended

Participants:237

Verdict:Accepted
Score:100 / 100
Submitted:2017-10-22 12:33:28

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1001;
int N;
vector<double> x(maxn), y(maxn), r(maxn);
vector<int> parent(maxn);
bool cmp(const int& a, const int& b){
    return r[a] > r[b];
}
// ji?
bool isChild(int a, int b){
    double dis = (x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]);
    dis = sqrt(dis);
    if(dis + r[b] < r[a]) return true;
    else return false;
}
int main(){
    cin >> N;
    vector<int> A(N);
    for(int i = 0;i < N;i++){
        cin>>x[i]>>y[i]>>r[i];
        A[i] = i;
    }
    sort(A.begin(), A.end(), cmp);
/*
    for(int i = 0; i < N;i++)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX