# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102376 | 2019-03-24T14:44:29 Z | tjdgus4384 | Circle selection (APIO18_circle_selection) | C++14 | 208 ms | 8580 KB |
#include<cstdio> #include<algorithm> #include<iostream> #include<vector> using namespace std; vector<pair<pair<int, int>, pair<int, int> > > v; vector<int> answer; bool visited[300002]; bool can(int a, int b){ int ax = v[a].second.first; int ay = v[a].second.second; int bx = v[b].second.first; 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 y >= x; } int main(){ int n; scanf("%d", &n); v.resize(n + 1); answer.resize(n + 1); for(int i = 1;i <= n;i++){ scanf("%d %d %d", &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; answer[i] = i; } sort(v.begin(), v.end()); for(int i = 1;i <= n;i++){ if(visited[i]) continue; for(int j = i + 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(int i = 1;i <= n;i++){ printf("%d ", 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 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 208 ms | 8580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 186 ms | 7164 KB | Output isn't correct |
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 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | 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 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |