Submission #1043432

# Submission time Handle Problem Language Result Execution time Memory
1043432 2024-08-04T09:27:48 Z vjudge1 Circle selection (APIO18_circle_selection) C++17
0 / 100
163 ms 12696 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

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

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

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

    if (n <= 5000){
        while (1){
            int mx = -1;
            for (int 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 (int 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 (int 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 Incorrect 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 147 ms 11548 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 12696 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 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -