/*input
11
9 9 2
13 2 1
11 8 2
3 3 2
3 12 1
12 14 1
9 8 5
2 8 2
5 2 1
14 4 2
14 14 1
*/
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma target("avx3")
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
const int maxn=3e5+5;
#define pb push_back
#define lowb(x) x&(-x)
#define ll long long
#define MNTO(x,y) x=min(x,y)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define pii pair<ll,ll>
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define sz(x) (int)x.size()
pair<pii,ll> arr[maxn];
inline bool inter(int a,int b){
ll d=(arr[a].f.s-arr[b].f.s)*(arr[a].f.s-arr[b].f.s)+(arr[a].f.f-arr[b].f.f)*(arr[a].f.f-arr[b].f.f);
return d<=(arr[a].s+arr[b].s)*(arr[a].s+arr[b].s);
}
bool ok[maxn];
int ans[maxn];
int seg[4*maxn];
int lazy[4*maxn];
void pushdown(int idx,int l,int r){
if(!lazy[idx]) return;
seg[idx]=lazy[idx];
if(l==r){
lazy[idx]=0;
return;
}
lazy[idx*2]=lazy[idx*2+1]=lazy[idx];
lazy[idx]=0;
}
void upd(int idx,int l,int r,int ql,int qr,int x){
pushdown(idx,l,r);
if(r<ql or l>qr) return;
if(ql<=l and r<=qr){
lazy[idx]=x;
pushdown(idx,l,r);
return;
}
int mid=(l+r)/2;
upd(idx*2,l,mid,ql,qr,x),upd(idx*2+1,mid+1,r,ql,qr,x);
seg[idx]=max(seg[idx*2],seg[idx*2+1]);
}
int query(int idx,int l,int r,int ql,int qr){
if(r<ql or l>qr) return 0;
pushdown(idx,l,r);
if(ql<=l and r<=qr) return seg[idx];
int mid=(l+r)/2;
return max(query(idx*2,l,mid,ql,qr),query(idx*2+1,mid+1,r,ql,qr));
}
int main(){
ios::sync_with_stdio(false),cin.tie(0);
int n;
cin>>n;
map<int,int> mp;
set<int> s;
vector<pii> vv;
REP(i,n) cin>>arr[i].f.f>>arr[i].f.s>>arr[i].s,s.insert(arr[i].f.f-arr[i].s),s.insert(arr[i].f.f+arr[i].s),vv.pb({arr[i].s,-i});
vector<int> v(ALL(s));
REP(i,sz(v)) mp[v[i]]=i;
sort(ALL(vv));
reverse(ALL(vv));
REP(asd,n){
int i=-vv[asd].s;
int l=mp[arr[i].f.f-arr[i].s],r=mp[arr[i].f.f+arr[i].s];
int k=query(1,0,sz(v)-1,l,r);
if(k) ans[i]=n-k;
else upd(1,0,sz(v)-1,l,r,n-asd),ans[i]=asd;
}
REP(i,n){
cout<<-vv[ans[i]].s+1<<' ';
}
}
Compilation message
circle_selection.cpp:17: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
17 | #pragma target("avx3")
|
# |
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 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1597 ms |
165228 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1348 ms |
165644 KB |
Execution killed with signal 11 |
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 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
4 |
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 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |