Submission #1043433

# Submission time Handle Problem Language Result Execution time Memory
1043433 2024-08-04T09:28:09 Z vjudge1 Circle selection (APIO18_circle_selection) C++17
7 / 100
165 ms 7508 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const ll N = 3e5 + 10;
ll n, a[N][3], par[N];

ll dist(ll a, ll b, ll x, ll y){
    return ((x - a) * (x - a) + (y - b) * (y - b));
}

int main(){
    cin >> n;
    for (ll i = 1; i <= n; i ++)
        for (ll j = 0; j < 3; j ++)
            cin >> a[i][j];

    if (n <= 5000){
        while (1){
            ll mx = -1;
            for (ll i = 1; i <= n; i ++)
                if (!par[i] and (mx == -1 or a[i][2] > a[mx][2]))
                    mx = i;

            if (mx == -1) break;

            for (ll i = 1; i <= n; i ++)
                if (!par[i] and dist(a[i][0], a[i][1], a[mx][0], a[mx][1]) <= (a[i][2] + a[mx][2]) * (a[i][2] + a[mx][2]))
                    par[i] = mx;
        }

        for (ll i = 1; i <= n; i ++)
            cout << par[i] << " ";
        cout << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2492 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 4 ms 2652 KB Output is correct
20 Correct 4 ms 2608 KB Output is correct
21 Correct 4 ms 2652 KB Output is correct
22 Correct 61 ms 2652 KB Output is correct
23 Correct 62 ms 2652 KB Output is correct
24 Correct 62 ms 2652 KB Output is correct
25 Correct 62 ms 2652 KB Output is correct
26 Correct 66 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 7508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Incorrect 70 ms 7092 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 165 ms 7508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2492 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 4 ms 2652 KB Output is correct
20 Correct 4 ms 2608 KB Output is correct
21 Correct 4 ms 2652 KB Output is correct
22 Correct 61 ms 2652 KB Output is correct
23 Correct 62 ms 2652 KB Output is correct
24 Correct 62 ms 2652 KB Output is correct
25 Correct 62 ms 2652 KB Output is correct
26 Correct 66 ms 2652 KB Output is correct
27 Incorrect 7 ms 2652 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2492 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 4 ms 2652 KB Output is correct
20 Correct 4 ms 2608 KB Output is correct
21 Correct 4 ms 2652 KB Output is correct
22 Correct 61 ms 2652 KB Output is correct
23 Correct 62 ms 2652 KB Output is correct
24 Correct 62 ms 2652 KB Output is correct
25 Correct 62 ms 2652 KB Output is correct
26 Correct 66 ms 2652 KB Output is correct
27 Incorrect 142 ms 7508 KB Output isn't correct
28 Halted 0 ms 0 KB -