답안 #978703

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
978703 2024-05-09T14:11:23 Z De3b0o 원 고르기 (APIO18_circle_selection) C++14
7 / 100
37 ms 1776 KB
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)

using namespace std;

ll fp(ll x , ll y)
{
    if(y==0)
        return 1;
    ll z = fp(x,y/2);
    if(y&1)
        return z*z*x;
    else
        return z*z;
}

int sqrot(ll x)
{
    int l = 0 , r = INT_MAX;
    while(l<=r)
    {
        if(mid*mid>=x)
            r=mid-1;
        else
            l=mid+1;
    }
    return r+1;
}

ll cel(ll x , ll y)
{
    return x/y + bool(x%y);
}

string tb(ll x)
{
    string s = "";
    while(x>0)
    {
        if(x&1)
            s+='1';
        else
            s+='0';
        x/=2;
    }
    while(s.size()<60)
        s+='0';
    return s;
}

ll fb(string s)
{
    ll x = 0;
    ll c = 1;
    for(int8_t i = 0 ; 60>i ; i++)
    {
        if(s[i]=='1')
            x+=c;
        c*=2;
    }
    return x;
}

ll x[5009] , y[5009] , r[5009] , ans[5009];

int main()
{
    ll n;
    cin >> n;
    set<pll> s;
    for(int i = 0 ; n>i ; i++)
    {
        cin >> x[i] >> y[i] >> r[i];
        s.in({r[i],-i});
    }
    while(!s.empty())
    {
        auto it = s.end();
        it--;
        ll c = -it->S;
        for(int i = 0 ; n>i ; i++)
        {
            ll d1 = (x[i]-x[c])*(x[i]-x[c]) + (y[i]-y[c])*(y[i]-y[c]);
            ll d2 = (r[i]+r[c])*(r[i]+r[c]);
            if(d1<=d2)
            {
                it = s.find({r[i],-i});
                if(it==s.end())
                    continue;
                ans[i]=c+1;
                s.erase(it);
            }
        }
    }
    for(int i = 0 ; n>i ; i++)
        cout << ans[i] << " ";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 436 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 6 ms 860 KB Output is correct
20 Correct 6 ms 856 KB Output is correct
21 Correct 7 ms 856 KB Output is correct
22 Correct 32 ms 1020 KB Output is correct
23 Correct 32 ms 860 KB Output is correct
24 Correct 33 ms 1016 KB Output is correct
25 Correct 31 ms 1000 KB Output is correct
26 Correct 37 ms 952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 1628 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 6 ms 1628 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 436 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 6 ms 860 KB Output is correct
20 Correct 6 ms 856 KB Output is correct
21 Correct 7 ms 856 KB Output is correct
22 Correct 32 ms 1020 KB Output is correct
23 Correct 32 ms 860 KB Output is correct
24 Correct 33 ms 1016 KB Output is correct
25 Correct 31 ms 1000 KB Output is correct
26 Correct 37 ms 952 KB Output is correct
27 Runtime error 7 ms 1628 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 436 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 6 ms 860 KB Output is correct
20 Correct 6 ms 856 KB Output is correct
21 Correct 7 ms 856 KB Output is correct
22 Correct 32 ms 1020 KB Output is correct
23 Correct 32 ms 860 KB Output is correct
24 Correct 33 ms 1016 KB Output is correct
25 Correct 31 ms 1000 KB Output is correct
26 Correct 37 ms 952 KB Output is correct
27 Runtime error 9 ms 1628 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -