답안 #982378

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982378 2024-05-14T07:44:01 Z Sir_Ahmed_Imran 원 고르기 (APIO18_circle_selection) C++17
12 / 100
1039 ms 58336 KB
                              ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 300001
int x[N];
int r[N];
int a[N];
set<pii> p,q;
void solve(){
    int n,m;
    cin>>n;
    priority_queue<pii> Q;
    for(int i=1;i<=n;i++){
        cin>>x[i]>>m>>r[i];
        Q.push({r[i],-i});
        p.add({x[i]+r[i],i});
        q.add({x[i]-r[i],i});
    }
    m=2e9+7;
    p.add({m,0});
    q.add({m,0});
    while(!Q.empty()){
        m=-Q.top().ss;
        if(a[m]){
            Q.pop();
            continue;
        }
        set<int> s;
        for(auto i=p.lower_bound({x[m]-r[m],0});(*i).ff<=x[m]+r[m];i++){
            s.add((*i).ss);
            a[(*i).ss]=m;
        }
        for(auto i=q.lower_bound({x[m]-r[m],0});(*i).ff<=x[m]+r[m];i++){
            s.add((*i).ss);
            a[(*i).ss]=m;
        }
        for(auto& i:s){
            p.erase({x[i]+r[i],i});
            q.erase({x[i]-r[i],i});
        }
    }
    for(int i=1;i<=n;i++) 
        cout<<a[i]<<' ';
}
int terminator(){
    L0TA;
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1039 ms 51772 KB Output is correct
2 Correct 906 ms 51192 KB Output is correct
3 Correct 1002 ms 54168 KB Output is correct
4 Correct 1006 ms 58336 KB Output is correct
5 Correct 543 ms 40884 KB Output is correct
6 Correct 613 ms 42480 KB Output is correct
7 Correct 656 ms 40912 KB Output is correct
8 Correct 556 ms 40904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 504 ms 36968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -