Submission #571575

# Submission time Handle Problem Language Result Execution time Memory
571575 2022-06-02T11:18:19 Z Cross_Ratio Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 18844 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int X[300005];
int Y[300005];
int R[300005];
int ans[300005];
bool used[300005];
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N;
    cin >> N;
    int i, j;
    for(i=0;i<N;i++) cin >> X[i] >> Y[i] >> R[i];
    while(true) {
        int ma = 0;
        int id = -1;
        for(i=0;i<N;i++) {
            if(!used[i]&&ma < R[i]) {
                ma = R[i];
                id = i;
            }
        }
        if(id==-1) break;
        for(i=0;i<N;i++) {
            if(used[i]) continue;
            if((X[i]-X[id])*(X[i]-X[id])+(Y[i]-Y[id])*(Y[i]-Y[id])<=(R[i]+R[id])*(R[i]+R[id])) {
                used[i] = true;
                ans[i] = id;
            }
        }
    }
    for(i=0;i<N;i++) cout << ans[i]+1 << ' ';
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:15:12: warning: unused variable 'j' [-Wunused-variable]
   15 |     int i, j;
      |            ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 3 ms 580 KB Output is correct
20 Correct 4 ms 596 KB Output is correct
21 Correct 4 ms 592 KB Output is correct
22 Correct 150 ms 636 KB Output is correct
23 Correct 142 ms 716 KB Output is correct
24 Correct 139 ms 644 KB Output is correct
25 Correct 148 ms 632 KB Output is correct
26 Correct 134 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 103 ms 18776 KB Output is correct
2 Correct 148 ms 18760 KB Output is correct
3 Correct 106 ms 18440 KB Output is correct
4 Correct 120 ms 18844 KB Output is correct
5 Execution timed out 3056 ms 14532 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Execution timed out 3069 ms 6292 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3007 ms 15392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 3 ms 580 KB Output is correct
20 Correct 4 ms 596 KB Output is correct
21 Correct 4 ms 592 KB Output is correct
22 Correct 150 ms 636 KB Output is correct
23 Correct 142 ms 716 KB Output is correct
24 Correct 139 ms 644 KB Output is correct
25 Correct 148 ms 632 KB Output is correct
26 Correct 134 ms 640 KB Output is correct
27 Correct 4 ms 980 KB Output is correct
28 Correct 6 ms 980 KB Output is correct
29 Correct 6 ms 980 KB Output is correct
30 Correct 567 ms 964 KB Output is correct
31 Correct 566 ms 924 KB Output is correct
32 Correct 552 ms 936 KB Output is correct
33 Correct 39 ms 7248 KB Output is correct
34 Correct 38 ms 7208 KB Output is correct
35 Correct 47 ms 7032 KB Output is correct
36 Execution timed out 3096 ms 6160 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 3 ms 580 KB Output is correct
20 Correct 4 ms 596 KB Output is correct
21 Correct 4 ms 592 KB Output is correct
22 Correct 150 ms 636 KB Output is correct
23 Correct 142 ms 716 KB Output is correct
24 Correct 139 ms 644 KB Output is correct
25 Correct 148 ms 632 KB Output is correct
26 Correct 134 ms 640 KB Output is correct
27 Correct 103 ms 18776 KB Output is correct
28 Correct 148 ms 18760 KB Output is correct
29 Correct 106 ms 18440 KB Output is correct
30 Correct 120 ms 18844 KB Output is correct
31 Execution timed out 3056 ms 14532 KB Time limit exceeded
32 Halted 0 ms 0 KB -