답안 #978710

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
978710 2024-05-09T14:20:51 Z De3b0o 원 고르기 (APIO18_circle_selection) C++14
0 / 100
863 ms 56960 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[300009] , y[300009] , r[300009] , ans[300009];

int main()
{
    ll n;
    cin >> n;
    set<pll> s;
    set<pll> s1;
    for(int i = 0 ; n>i ; i++)
    {
        cin >> x[i] >> y[i] >> r[i];
        s.in({r[i],-i});
        s1.in({x[i],i});
    }
    while(!s.empty())
    {
        auto it = s.end();
        it--;
        ll c = -it->S;
        vector<ll> v;
        auto it1 = s1.find({x[c],c});
        while(it1!=s1.begin())
        {
            it1--;
            ll e = it1->S;
            ll d1 = (x[e]-x[c])*(x[e]-x[c]) + (y[e]-y[c])*(y[e]-y[c]);
            ll d2 = (r[e]+r[c])*(r[e]+r[c]);
            if(d1>d2)
                break;
            v.pb(e);
        }
        it1 = s1.find({x[c],c});
        while(it1!=s1.end())
        {
            ll e = it1->S;
            ll d1 = (x[e]-x[c])*(x[e]-x[c]) + (y[e]-y[c])*(y[e]-y[c]);
            ll d2 = (r[e]+r[c])*(r[e]+r[c]);
            if(d1>d2)
                break;
            v.pb(e);
            it1++;
        }
        for(auto it2 : v)
        {
            ans[it2]=c+1;
            s1.erase(s1.find({x[it2],it2}));
            s.erase(s.find({r[it2],-it2}));
        }
    }
    for(int i = 0 ; n>i ; i++)
        cout << ans[i] << " ";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Incorrect 1 ms 6492 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 863 ms 56692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 6492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 778 ms 56960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Incorrect 1 ms 6492 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Incorrect 1 ms 6492 KB Output isn't correct
9 Halted 0 ms 0 KB -