Submission #1075375

# Submission time Handle Problem Language Result Execution time Memory
1075375 2024-08-26T04:46:35 Z HappyCapybara Circle selection (APIO18_circle_selection) C++17
7 / 100
3000 ms 26928 KB
#include<bits/stdc++.h>
using namespace std;

double eps = pow(10, -9);

double dist(int ax, int ay, int bx, int by){
    return sqrt(pow(ax-bx, 2)+pow(ay-by, 2));
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> v(n);
    for (int i=0; i<n; i++){
        int x, y, r;
        cin >> x >> y >> r;
        v[i] = {-r, i, x, y};
    }
    sort(v.begin(), v.end());
    int x = 0;
    vector<int> done(n, 0);
    while (x != n){
        //cout << x << "\n";
        int cur;
        for (int i=0; i<n; i++){
            if (!done[v[i][1]]){
                cur = i;
                break;
            }
        }
        /*cout << cur << "!\n";
        cout << done[v[cur][1]] << "\n";*/
        for (int i=0; i<n; i++){
            //cout << i << " " << dist(v[cur][2], v[cur][3], v[i][2], v[i][3]) << "\n";
            if (!done[v[i][1]] && dist(v[cur][2], v[cur][3], v[i][2], v[i][3]) < eps+(double) (0-(v[cur][0]+v[i][0]))){
                //cout << i << "\n";
                done[v[i][1]] = v[cur][1]+1;
                x++;
            }
        }
    }
    for (int i=0; i<n; i++) cout << done[i] << "\n";
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:35:56: warning: 'cur' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |             if (!done[v[i][1]] && dist(v[cur][2], v[cur][3], v[i][2], v[i][3]) < eps+(double) (0-(v[cur][0]+v[i][0]))){
      |                                                        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 5 ms 800 KB Output is correct
20 Correct 5 ms 860 KB Output is correct
21 Correct 5 ms 692 KB Output is correct
22 Correct 78 ms 844 KB Output is correct
23 Correct 86 ms 852 KB Output is correct
24 Correct 79 ms 856 KB Output is correct
25 Correct 83 ms 696 KB Output is correct
26 Correct 75 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 269 ms 19936 KB Output is correct
2 Correct 263 ms 26760 KB Output is correct
3 Correct 254 ms 26452 KB Output is correct
4 Correct 243 ms 26928 KB Output is correct
5 Execution timed out 3039 ms 22608 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 3045 ms 8820 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3078 ms 18004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 5 ms 800 KB Output is correct
20 Correct 5 ms 860 KB Output is correct
21 Correct 5 ms 692 KB Output is correct
22 Correct 78 ms 844 KB Output is correct
23 Correct 86 ms 852 KB Output is correct
24 Correct 79 ms 856 KB Output is correct
25 Correct 83 ms 696 KB Output is correct
26 Correct 75 ms 848 KB Output is correct
27 Correct 10 ms 1368 KB Output is correct
28 Correct 9 ms 1372 KB Output is correct
29 Correct 9 ms 1336 KB Output is correct
30 Correct 377 ms 1288 KB Output is correct
31 Correct 394 ms 1112 KB Output is correct
32 Correct 393 ms 1292 KB Output is correct
33 Correct 111 ms 9940 KB Output is correct
34 Correct 107 ms 9808 KB Output is correct
35 Correct 125 ms 9684 KB Output is correct
36 Execution timed out 3018 ms 8624 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 5 ms 800 KB Output is correct
20 Correct 5 ms 860 KB Output is correct
21 Correct 5 ms 692 KB Output is correct
22 Correct 78 ms 844 KB Output is correct
23 Correct 86 ms 852 KB Output is correct
24 Correct 79 ms 856 KB Output is correct
25 Correct 83 ms 696 KB Output is correct
26 Correct 75 ms 848 KB Output is correct
27 Correct 269 ms 19936 KB Output is correct
28 Correct 263 ms 26760 KB Output is correct
29 Correct 254 ms 26452 KB Output is correct
30 Correct 243 ms 26928 KB Output is correct
31 Execution timed out 3039 ms 22608 KB Time limit exceeded
32 Halted 0 ms 0 KB -