Submission #111230

# Submission time Handle Problem Language Result Execution time Memory
111230 2019-05-14T10:57:11 Z SamAnd Circle selection (APIO18_circle_selection) C++17
7 / 100
420 ms 13560 KB
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int N = 300005;
struct ban
{
    int i;
    int x, y, r;
};
bool operator<(const ban& a, const ban& b)
{
    if (a.r < b.r)
        return true;
    if (a.r > b.r)
        return false;
    return a.i > b.i;
}

int n;
ban a[N];

int ans[N];

priority_queue<ban> q;
int get()
{
    while (1)
    {
        if (q.empty())
            return -1;
        ban t = q.top();
        q.pop();
        if (!ans[t.i])
            return t.i;
    }
}

bool stg(long long x1, long long y1, long long r1, long long x2, long long y2, long long r2)
{
    return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) <= (r1 + r2) * (r1 + r2);
}

void solv0()
{
    for (int i = 1; i <= n; ++i)
        q.push(a[i]);
    while (1)
    {
        int i = get();
        if (i == -1)
            return;
        for (int j = 1; j <= n; ++j)
        {
            if (!ans[j])
            {
                if (stg(a[i].x, a[i].y, a[i].r, a[j].x, a[j].y, a[j].r))
                {
                    ans[j] = i;
                }
            }
        }
    }
}

int main()
{
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        a[i].i = i;
        cin >> a[i].x >> a[i].y >> a[i].r;
    }
    if (n <= 5000)
        solv0();
    for (int i = 1; i <= n; ++i)
        cout << ans[i] << ' ';
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 372 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 12 ms 896 KB Output is correct
20 Correct 11 ms 896 KB Output is correct
21 Correct 11 ms 768 KB Output is correct
22 Correct 110 ms 860 KB Output is correct
23 Correct 121 ms 768 KB Output is correct
24 Correct 106 ms 768 KB Output is correct
25 Correct 101 ms 892 KB Output is correct
26 Correct 101 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 365 ms 12452 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 148 ms 4972 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 420 ms 13560 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 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 372 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 12 ms 896 KB Output is correct
20 Correct 11 ms 896 KB Output is correct
21 Correct 11 ms 768 KB Output is correct
22 Correct 110 ms 860 KB Output is correct
23 Correct 121 ms 768 KB Output is correct
24 Correct 106 ms 768 KB Output is correct
25 Correct 101 ms 892 KB Output is correct
26 Correct 101 ms 888 KB Output is correct
27 Incorrect 17 ms 768 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 372 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 12 ms 896 KB Output is correct
20 Correct 11 ms 896 KB Output is correct
21 Correct 11 ms 768 KB Output is correct
22 Correct 110 ms 860 KB Output is correct
23 Correct 121 ms 768 KB Output is correct
24 Correct 106 ms 768 KB Output is correct
25 Correct 101 ms 892 KB Output is correct
26 Correct 101 ms 888 KB Output is correct
27 Incorrect 365 ms 12452 KB Output isn't correct
28 Halted 0 ms 0 KB -