답안 #1087886

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1087886 2024-09-13T11:01:46 Z alexander707070 원 고르기 (APIO18_circle_selection) C++14
7 / 100
3000 ms 1048576 KB
#include<bits/stdc++.h>
#define MAXN 1000007
using namespace std;

int n,par[MAXN];
long long x[MAXN],y[MAXN],r[MAXN];
pair<int,int> p[MAXN];

vector<int> g[MAXN];

int main(){

    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x[i]>>y[i]>>r[i];

        p[i]={r[i],-i};
    }

    sort(p+1,p+n+1);

    for(int i=1;i<=n;i++){
        for(int f=i+1;f<=n;f++){
            if((x[i]-x[f])*(x[i]-x[f]) + (y[i]-y[f])*(y[i]-y[f]) <= (r[i]+r[f])*(r[i]+r[f])){
                g[i].push_back(f);
                g[f].push_back(i);
            }
        }
    }

    for(int i=n;i>=1;i--){
        int curr=-p[i].second;
        if(par[curr]!=0)continue;

        par[curr]=curr;
        for(int f=0;f<g[curr].size();f++){
            if(par[g[curr][f]]==0)par[g[curr][f]]=curr;
        }
    }

    for(int i=1;i<=n;i++){
        cout<<par[i]<<" ";
    }
    cout<<"\n";

    return 0;
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:36:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         for(int f=0;f<g[curr].size();f++){
      |                     ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23896 KB Output is correct
2 Correct 10 ms 23900 KB Output is correct
3 Correct 10 ms 23804 KB Output is correct
4 Correct 15 ms 23900 KB Output is correct
5 Correct 10 ms 23900 KB Output is correct
6 Correct 11 ms 23912 KB Output is correct
7 Correct 10 ms 23900 KB Output is correct
8 Correct 11 ms 23776 KB Output is correct
9 Correct 11 ms 23900 KB Output is correct
10 Correct 12 ms 23912 KB Output is correct
11 Correct 11 ms 23956 KB Output is correct
12 Correct 11 ms 23788 KB Output is correct
13 Correct 10 ms 23968 KB Output is correct
14 Correct 10 ms 23900 KB Output is correct
15 Correct 10 ms 23884 KB Output is correct
16 Correct 18 ms 28252 KB Output is correct
17 Correct 18 ms 27996 KB Output is correct
18 Correct 17 ms 28252 KB Output is correct
19 Correct 195 ms 158032 KB Output is correct
20 Correct 186 ms 158032 KB Output is correct
21 Correct 174 ms 107344 KB Output is correct
22 Correct 34 ms 24152 KB Output is correct
23 Correct 36 ms 24228 KB Output is correct
24 Correct 35 ms 24156 KB Output is correct
25 Correct 36 ms 24156 KB Output is correct
26 Correct 33 ms 24152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3080 ms 1038968 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23900 KB Output is correct
2 Execution timed out 3065 ms 29848 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3031 ms 41040 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23896 KB Output is correct
2 Correct 10 ms 23900 KB Output is correct
3 Correct 10 ms 23804 KB Output is correct
4 Correct 15 ms 23900 KB Output is correct
5 Correct 10 ms 23900 KB Output is correct
6 Correct 11 ms 23912 KB Output is correct
7 Correct 10 ms 23900 KB Output is correct
8 Correct 11 ms 23776 KB Output is correct
9 Correct 11 ms 23900 KB Output is correct
10 Correct 12 ms 23912 KB Output is correct
11 Correct 11 ms 23956 KB Output is correct
12 Correct 11 ms 23788 KB Output is correct
13 Correct 10 ms 23968 KB Output is correct
14 Correct 10 ms 23900 KB Output is correct
15 Correct 10 ms 23884 KB Output is correct
16 Correct 18 ms 28252 KB Output is correct
17 Correct 18 ms 27996 KB Output is correct
18 Correct 17 ms 28252 KB Output is correct
19 Correct 195 ms 158032 KB Output is correct
20 Correct 186 ms 158032 KB Output is correct
21 Correct 174 ms 107344 KB Output is correct
22 Correct 34 ms 24152 KB Output is correct
23 Correct 36 ms 24228 KB Output is correct
24 Correct 35 ms 24156 KB Output is correct
25 Correct 36 ms 24156 KB Output is correct
26 Correct 33 ms 24152 KB Output is correct
27 Correct 767 ms 406220 KB Output is correct
28 Correct 816 ms 500560 KB Output is correct
29 Correct 801 ms 481360 KB Output is correct
30 Correct 99 ms 24508 KB Output is correct
31 Correct 99 ms 24412 KB Output is correct
32 Correct 105 ms 24412 KB Output is correct
33 Runtime error 1726 ms 1048576 KB Execution killed with signal 9
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23896 KB Output is correct
2 Correct 10 ms 23900 KB Output is correct
3 Correct 10 ms 23804 KB Output is correct
4 Correct 15 ms 23900 KB Output is correct
5 Correct 10 ms 23900 KB Output is correct
6 Correct 11 ms 23912 KB Output is correct
7 Correct 10 ms 23900 KB Output is correct
8 Correct 11 ms 23776 KB Output is correct
9 Correct 11 ms 23900 KB Output is correct
10 Correct 12 ms 23912 KB Output is correct
11 Correct 11 ms 23956 KB Output is correct
12 Correct 11 ms 23788 KB Output is correct
13 Correct 10 ms 23968 KB Output is correct
14 Correct 10 ms 23900 KB Output is correct
15 Correct 10 ms 23884 KB Output is correct
16 Correct 18 ms 28252 KB Output is correct
17 Correct 18 ms 27996 KB Output is correct
18 Correct 17 ms 28252 KB Output is correct
19 Correct 195 ms 158032 KB Output is correct
20 Correct 186 ms 158032 KB Output is correct
21 Correct 174 ms 107344 KB Output is correct
22 Correct 34 ms 24152 KB Output is correct
23 Correct 36 ms 24228 KB Output is correct
24 Correct 35 ms 24156 KB Output is correct
25 Correct 36 ms 24156 KB Output is correct
26 Correct 33 ms 24152 KB Output is correct
27 Execution timed out 3080 ms 1038968 KB Time limit exceeded
28 Halted 0 ms 0 KB -