# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102371 | 2019-03-24T14:26:42 Z | tjdgus4384 | Circle selection (APIO18_circle_selection) | C++14 | 189 ms | 15368 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]; double dist(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; return (ax - bx) * (ax - bx) + (ay - by) * (ay - by); } int main(){ int n; scanf("%d", &n); v.resize(n); answer.resize(n); for(int i = 0;i < n;i++){ scanf("%d %d %d", &v[i].second.first, &v[i].second.second, &v[i].first.first); v[i].first.second = i + 1; v[i].first.first = -v[i].first.first; answer[i + 1] = i + 1; } sort(v.begin(), v.end()); for(int i = 0;i < n;i++){ if(visited[i]) continue; for(int j = i + 1;j < n;j++){ if(visited[j]) continue; if(dist(i, j) <= (v[i].first.first + v[j].first.first)*(v[i].first.first + v[j].first.first)){ 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 | 3 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 189 ms | 15368 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 174 ms | 15068 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |