# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102388 | 2019-03-24T15:19:49 Z | tjdgus4384 | Circle selection (APIO18_circle_selection) | C++14 | 3000 ms | 21384 KB |
#include<cstdio> #include<algorithm> #include<iostream> #include<vector> using namespace std; vector<pair<pair<long long int, long long int>, pair<long long int, long long int> > > v; vector<long long int> answer; bool visited[500003]; bool can(long long int a, long long int b){ long long int ax = v[a].second.first; long long int ay = v[a].second.second; long long int bx = v[b].second.first; long long int by = v[b].second.second; long long int x = (ax - bx) * (ax - bx) + (ay - by) * (ay - by); long long int y = (v[a].first.first + v[b].first.first) * (v[a].first.first + v[b].first.first); return (v[a].first.first + v[b].first.first) * (v[a].first.first + v[b].first.first) >= x; } int main(){ long long int n; scanf("%lld", &n); v.resize(n + 1); answer.resize(n + 1); for(long long int i = 1;i <= n;i++){ scanf("%lld %lld %lld", &v[i].second.first, &v[i].second.second, &v[i].first.first); v[i].first.second = i; v[i].first.first = -v[i].first.first; } sort(v.begin() + 1, v.end()); for(long long int i = 1;i <= n;i++){ if(visited[i]) continue; for(long long int j = 1;j <= n;j++){ if(visited[j]) continue; if(can(i, j)){ answer[v[j].first.second] = v[i].first.second; visited[j] = true; } } } for(long long int i = 1;i <= n;i++){ printf("%lld ", answer[i]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 4 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 768 KB | Output is correct |
20 | Correct | 6 ms | 768 KB | Output is correct |
21 | Correct | 5 ms | 768 KB | Output is correct |
22 | Correct | 57 ms | 640 KB | Output is correct |
23 | Correct | 67 ms | 760 KB | Output is correct |
24 | Correct | 67 ms | 716 KB | Output is correct |
25 | Correct | 61 ms | 640 KB | Output is correct |
26 | Correct | 59 ms | 640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 220 ms | 14460 KB | Output is correct |
2 | Correct | 266 ms | 21236 KB | Output is correct |
3 | Correct | 220 ms | 20984 KB | Output is correct |
4 | Correct | 265 ms | 21384 KB | Output is correct |
5 | Execution timed out | 3006 ms | 17144 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 460 KB | Output is correct |
2 | Execution timed out | 3027 ms | 7176 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3011 ms | 12212 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 4 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 768 KB | Output is correct |
20 | Correct | 6 ms | 768 KB | Output is correct |
21 | Correct | 5 ms | 768 KB | Output is correct |
22 | Correct | 57 ms | 640 KB | Output is correct |
23 | Correct | 67 ms | 760 KB | Output is correct |
24 | Correct | 67 ms | 716 KB | Output is correct |
25 | Correct | 61 ms | 640 KB | Output is correct |
26 | Correct | 59 ms | 640 KB | Output is correct |
27 | Correct | 11 ms | 1152 KB | Output is correct |
28 | Correct | 9 ms | 1152 KB | Output is correct |
29 | Correct | 9 ms | 1152 KB | Output is correct |
30 | Correct | 225 ms | 1144 KB | Output is correct |
31 | Correct | 219 ms | 1020 KB | Output is correct |
32 | Correct | 237 ms | 1144 KB | Output is correct |
33 | Correct | 76 ms | 8056 KB | Output is correct |
34 | Correct | 84 ms | 8056 KB | Output is correct |
35 | Correct | 85 ms | 7928 KB | Output is correct |
36 | Execution timed out | 3091 ms | 6992 KB | Time limit exceeded |
37 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 512 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 4 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 768 KB | Output is correct |
20 | Correct | 6 ms | 768 KB | Output is correct |
21 | Correct | 5 ms | 768 KB | Output is correct |
22 | Correct | 57 ms | 640 KB | Output is correct |
23 | Correct | 67 ms | 760 KB | Output is correct |
24 | Correct | 67 ms | 716 KB | Output is correct |
25 | Correct | 61 ms | 640 KB | Output is correct |
26 | Correct | 59 ms | 640 KB | Output is correct |
27 | Correct | 220 ms | 14460 KB | Output is correct |
28 | Correct | 266 ms | 21236 KB | Output is correct |
29 | Correct | 220 ms | 20984 KB | Output is correct |
30 | Correct | 265 ms | 21384 KB | Output is correct |
31 | Execution timed out | 3006 ms | 17144 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |