Submission #698754

# Submission time Handle Problem Language Result Execution time Memory
698754 2023-02-14T09:23:16 Z vjudge1 Circle selection (APIO18_circle_selection) C++17
0 / 100
3000 ms 16544 KB
#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
using namespace std;
const int N = 3e5 + 10, mod = 1e9 + 7;
int n, x[N], y[N], r[N], ans[N];
vector<pair<int, int> > v;
signed main()
{
    FAST;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        int x1, y1, r1;
        cin >> x1 >> y1 >> r1;
        v.push_back({r1, -i});
        x[i] = x1;
        y[i] = y1;
        r[i] = r1;
    }
    sort(all(v));
    reverse(all(v));
    for(auto it : v) {
        if(ans[-it.second] == 0) {
            ans[-it.second] = -it.second;
            for(auto i : v) {
                if(i.second == it.second) continue;
                int a = x[-it.second] - x[-i.second];
                int b = y[-it.second] - y[-i.second];
                int c = r[-it.second] + r[-i.second];
                if((a*a) + (b*b) <= (c * c)) {
                    ans[-i.second] = -it.second;
                }
            }
        }
    }
    for(int i = 1; i <= n; i++) cout << ans[i] << ' ';
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 0 ms 340 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 16544 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Execution timed out 3081 ms 5188 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3088 ms 14824 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 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 0 ms 340 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 0 ms 340 KB Output isn't correct
9 Halted 0 ms 0 KB -