Submission #981502

# Submission time Handle Problem Language Result Execution time Memory
981502 2024-05-13T09:28:33 Z vjudge1 Circle selection (APIO18_circle_selection) C++17
7 / 100
154 ms 35876 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
const int N = 1e6 + 5, MOD = 998244353;
typedef long double ld;
ld dist(ld x,ld y,ld x1,ld y1){
    return sqrtl((x- x1) * (x - x1) + (y - y1) * (y - y1));
}
int n,p[N],res[N];
vector<array<ld,4>> a;
void test(){
    cin >> n;
    for(int i = 1;i <= n;i++){
        ll _x,_y,_r;
        cin >> _x >> _y >> _r;
        a.push_back({(ld)_r,(ld)-i,(ld)_x,(ld)_y});
        res[i] = -1;
    }
    sort(a.rbegin(),a.rend());
    if(n <= 5000) {
        for (int j = 0; j < n; j++) {
            ld r = a[j][0], x = a[j][2], y = a[j][3];
            int i = -a[j][1];
            if(res[i] != -1) continue;
            res[i] = i;
            for (int k = j + 1; k < n; k++) {
                if (res[(int)-a[k][1]]==-1&&dist(x,y,a[k][2],a[k][3]) <= r + a[k][0]) {
                    res[(int)-a[k][1]] = i;
                }
            }
        }
    }
    for(int i = 1;i <= n;i++){
        cout << res[i] << '\n';
    }
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int T = 1;
//    cin >> T;
    while (T--){
        test();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 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 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 3 ms 992 KB Output is correct
20 Correct 3 ms 992 KB Output is correct
21 Correct 3 ms 992 KB Output is correct
22 Correct 114 ms 992 KB Output is correct
23 Correct 98 ms 988 KB Output is correct
24 Correct 99 ms 988 KB Output is correct
25 Correct 99 ms 992 KB Output is correct
26 Correct 99 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 35824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 52 ms 10948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 146 ms 35876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 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 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 3 ms 992 KB Output is correct
20 Correct 3 ms 992 KB Output is correct
21 Correct 3 ms 992 KB Output is correct
22 Correct 114 ms 992 KB Output is correct
23 Correct 98 ms 988 KB Output is correct
24 Correct 99 ms 988 KB Output is correct
25 Correct 99 ms 992 KB Output is correct
26 Correct 99 ms 992 KB Output is correct
27 Incorrect 5 ms 1500 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 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 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 3 ms 992 KB Output is correct
20 Correct 3 ms 992 KB Output is correct
21 Correct 3 ms 992 KB Output is correct
22 Correct 114 ms 992 KB Output is correct
23 Correct 98 ms 988 KB Output is correct
24 Correct 99 ms 988 KB Output is correct
25 Correct 99 ms 992 KB Output is correct
26 Correct 99 ms 992 KB Output is correct
27 Incorrect 154 ms 35824 KB Output isn't correct
28 Halted 0 ms 0 KB -