Submission #77965

# Submission time Handle Problem Language Result Execution time Memory
77965 2018-10-01T13:29:27 Z autumn_eel Circle selection (APIO18_circle_selection) C++14
100 / 100
728 ms 86744 KB
#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}
/*
#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}
#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}#include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef double db;
using namespace std;

const int N=300010;
const db inf=1e20,eps=1e-3,alpha=acos(-1)/3;
int n,rt,ans[N];
db x,y,r;
struct P{ db x,y,r; int id; }cur,a[N];
struct Tr{ int ls,rs; db x1,y1,x2,y2; P c; }T[N];

bool cmpx(const P &a,const P &b){ return a.x<b.x; }
bool cmpy(const P &a,const P &b){ return a.y<b.y; }
bool cmpr(const P &a,const P &b){ return (a.r==b.r) ? a.id<b.id : a.r>b.r; }

void F(int x,int y){
    T[x].x1=min(T[x].x1,T[y].x1); T[x].x2=max(T[x].x2,T[y].x2);
    T[x].y1=min(T[x].y1,T[y].y1); T[x].y2=max(T[x].y2,T[y].y2);
}

void upd(int x){
    if (ans[T[x].c.id]) T[x].x1=T[x].y1=inf,T[x].x2=T[x].y2=-inf;
    else{
        T[x].x1=T[x].c.x-T[x].c.r; T[x].x2=T[x].c.x+T[x].c.r;
        T[x].y1=T[x].c.y-T[x].c.r; T[x].y2=T[x].c.y+T[x].c.r;
    }
    if (T[x].ls) F(x,T[x].ls);
    if (T[x].rs) F(x,T[x].rs);
}

int build(int l,int r,int k){
    if (l>r) return 0;
    int mid=(l+r)>>1; nth_element(a+l,a+mid,a+r+1,k?cmpy:cmpx);
    T[mid].c=a[mid];
    T[mid].ls=build(l,mid-1,k^1); T[mid].rs=build(mid+1,r,k^1);
    upd(mid); return mid;
}

db sqr(db x){ return x*x; }
bool Out(int x){ return (T[x].x2<cur.x-cur.r-eps) || (T[x].x1>cur.x+cur.r+eps) || (T[x].y2<cur.y-cur.r-eps) || (T[x].y1>cur.y+cur.r+eps); }
bool chk(P &a){ return sqr(a.x-cur.x)+sqr(a.y-cur.y)<=sqr(a.r+cur.r)+eps; }

void que(int x){
    if (Out(x)) return;
    if (!ans[T[x].c.id] && chk(T[x].c)) ans[T[x].c.id]=cur.id;
    if (T[x].ls) que(T[x].ls);
    if (T[x].rs) que(T[x].rs);
}

int main(){
    //~ freopen("apiob.in","r",stdin);
    //~ freopen("apiob.out","w",stdout);
    scanf("%d",&n);
    rep(i,1,n)
        scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
    rt=build(1,n,0); sort(a+1,a+n+1,cmpr);
    rep(i,1,n) if (!ans[a[i].id]) ans[a[i].id]=a[i].id,cur=a[i],que(rt);
    rep(i,1,n) printf("%d ",ans[i]); puts("");
    return 0;
}*/

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:4:20: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
 #define rep(i,l,r) for (int i=(l); i<=(r); i++)
                    ^
circle_selection.cpp:61:5: note: in expansion of macro 'rep'
     rep(i,1,n) printf("%d ",ans[i]); puts("");
     ^~~
circle_selection.cpp:61:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     rep(i,1,n) printf("%d ",ans[i]); puts("");
                                      ^~~~
circle_selection.cpp:56:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
circle_selection.cpp:58:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lf%lf%lf",&x,&y,&r),a[i]=(P){x*cos(alpha)+y*sin(alpha),y*cos(alpha)-x*sin(alpha),r,i};
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 520 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 3 ms 564 KB Output is correct
10 Correct 3 ms 568 KB Output is correct
11 Correct 2 ms 620 KB Output is correct
12 Correct 2 ms 624 KB Output is correct
13 Correct 2 ms 628 KB Output is correct
14 Correct 2 ms 632 KB Output is correct
15 Correct 2 ms 632 KB Output is correct
16 Correct 3 ms 772 KB Output is correct
17 Correct 3 ms 800 KB Output is correct
18 Correct 3 ms 800 KB Output is correct
19 Correct 7 ms 1376 KB Output is correct
20 Correct 7 ms 1528 KB Output is correct
21 Correct 8 ms 1696 KB Output is correct
22 Correct 8 ms 1868 KB Output is correct
23 Correct 8 ms 2012 KB Output is correct
24 Correct 8 ms 2160 KB Output is correct
25 Correct 8 ms 2300 KB Output is correct
26 Correct 8 ms 2428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 348 ms 42236 KB Output is correct
2 Correct 369 ms 46224 KB Output is correct
3 Correct 343 ms 46592 KB Output is correct
4 Correct 353 ms 46772 KB Output is correct
5 Correct 347 ms 46772 KB Output is correct
6 Correct 466 ms 47516 KB Output is correct
7 Correct 363 ms 47516 KB Output is correct
8 Correct 376 ms 47604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 47604 KB Output is correct
2 Correct 197 ms 47604 KB Output is correct
3 Correct 679 ms 47652 KB Output is correct
4 Correct 687 ms 47720 KB Output is correct
5 Correct 597 ms 47720 KB Output is correct
6 Correct 262 ms 47720 KB Output is correct
7 Correct 154 ms 47720 KB Output is correct
8 Correct 24 ms 47720 KB Output is correct
9 Correct 689 ms 52900 KB Output is correct
10 Correct 557 ms 54888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 704 ms 54932 KB Output is correct
2 Correct 680 ms 54964 KB Output is correct
3 Correct 453 ms 54964 KB Output is correct
4 Correct 671 ms 54964 KB Output is correct
5 Correct 660 ms 54972 KB Output is correct
6 Correct 395 ms 54972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 520 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 3 ms 564 KB Output is correct
10 Correct 3 ms 568 KB Output is correct
11 Correct 2 ms 620 KB Output is correct
12 Correct 2 ms 624 KB Output is correct
13 Correct 2 ms 628 KB Output is correct
14 Correct 2 ms 632 KB Output is correct
15 Correct 2 ms 632 KB Output is correct
16 Correct 3 ms 772 KB Output is correct
17 Correct 3 ms 800 KB Output is correct
18 Correct 3 ms 800 KB Output is correct
19 Correct 7 ms 1376 KB Output is correct
20 Correct 7 ms 1528 KB Output is correct
21 Correct 8 ms 1696 KB Output is correct
22 Correct 8 ms 1868 KB Output is correct
23 Correct 8 ms 2012 KB Output is correct
24 Correct 8 ms 2160 KB Output is correct
25 Correct 8 ms 2300 KB Output is correct
26 Correct 8 ms 2428 KB Output is correct
27 Correct 14 ms 54972 KB Output is correct
28 Correct 15 ms 54972 KB Output is correct
29 Correct 12 ms 54972 KB Output is correct
30 Correct 19 ms 54972 KB Output is correct
31 Correct 17 ms 54972 KB Output is correct
32 Correct 19 ms 54972 KB Output is correct
33 Correct 123 ms 54972 KB Output is correct
34 Correct 121 ms 54972 KB Output is correct
35 Correct 172 ms 54972 KB Output is correct
36 Correct 191 ms 54972 KB Output is correct
37 Correct 191 ms 54972 KB Output is correct
38 Correct 190 ms 54972 KB Output is correct
39 Correct 188 ms 54972 KB Output is correct
40 Correct 182 ms 54972 KB Output is correct
41 Correct 183 ms 54972 KB Output is correct
42 Correct 147 ms 54972 KB Output is correct
43 Correct 173 ms 54972 KB Output is correct
44 Correct 171 ms 54972 KB Output is correct
45 Correct 169 ms 54972 KB Output is correct
46 Correct 181 ms 54972 KB Output is correct
47 Correct 172 ms 54972 KB Output is correct
48 Correct 178 ms 54972 KB Output is correct
49 Correct 178 ms 54972 KB Output is correct
50 Correct 193 ms 54972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 520 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 3 ms 564 KB Output is correct
10 Correct 3 ms 568 KB Output is correct
11 Correct 2 ms 620 KB Output is correct
12 Correct 2 ms 624 KB Output is correct
13 Correct 2 ms 628 KB Output is correct
14 Correct 2 ms 632 KB Output is correct
15 Correct 2 ms 632 KB Output is correct
16 Correct 3 ms 772 KB Output is correct
17 Correct 3 ms 800 KB Output is correct
18 Correct 3 ms 800 KB Output is correct
19 Correct 7 ms 1376 KB Output is correct
20 Correct 7 ms 1528 KB Output is correct
21 Correct 8 ms 1696 KB Output is correct
22 Correct 8 ms 1868 KB Output is correct
23 Correct 8 ms 2012 KB Output is correct
24 Correct 8 ms 2160 KB Output is correct
25 Correct 8 ms 2300 KB Output is correct
26 Correct 8 ms 2428 KB Output is correct
27 Correct 348 ms 42236 KB Output is correct
28 Correct 369 ms 46224 KB Output is correct
29 Correct 343 ms 46592 KB Output is correct
30 Correct 353 ms 46772 KB Output is correct
31 Correct 347 ms 46772 KB Output is correct
32 Correct 466 ms 47516 KB Output is correct
33 Correct 363 ms 47516 KB Output is correct
34 Correct 376 ms 47604 KB Output is correct
35 Correct 2 ms 47604 KB Output is correct
36 Correct 197 ms 47604 KB Output is correct
37 Correct 679 ms 47652 KB Output is correct
38 Correct 687 ms 47720 KB Output is correct
39 Correct 597 ms 47720 KB Output is correct
40 Correct 262 ms 47720 KB Output is correct
41 Correct 154 ms 47720 KB Output is correct
42 Correct 24 ms 47720 KB Output is correct
43 Correct 689 ms 52900 KB Output is correct
44 Correct 557 ms 54888 KB Output is correct
45 Correct 704 ms 54932 KB Output is correct
46 Correct 680 ms 54964 KB Output is correct
47 Correct 453 ms 54964 KB Output is correct
48 Correct 671 ms 54964 KB Output is correct
49 Correct 660 ms 54972 KB Output is correct
50 Correct 395 ms 54972 KB Output is correct
51 Correct 14 ms 54972 KB Output is correct
52 Correct 15 ms 54972 KB Output is correct
53 Correct 12 ms 54972 KB Output is correct
54 Correct 19 ms 54972 KB Output is correct
55 Correct 17 ms 54972 KB Output is correct
56 Correct 19 ms 54972 KB Output is correct
57 Correct 123 ms 54972 KB Output is correct
58 Correct 121 ms 54972 KB Output is correct
59 Correct 172 ms 54972 KB Output is correct
60 Correct 191 ms 54972 KB Output is correct
61 Correct 191 ms 54972 KB Output is correct
62 Correct 190 ms 54972 KB Output is correct
63 Correct 188 ms 54972 KB Output is correct
64 Correct 182 ms 54972 KB Output is correct
65 Correct 183 ms 54972 KB Output is correct
66 Correct 147 ms 54972 KB Output is correct
67 Correct 173 ms 54972 KB Output is correct
68 Correct 171 ms 54972 KB Output is correct
69 Correct 169 ms 54972 KB Output is correct
70 Correct 181 ms 54972 KB Output is correct
71 Correct 172 ms 54972 KB Output is correct
72 Correct 178 ms 54972 KB Output is correct
73 Correct 178 ms 54972 KB Output is correct
74 Correct 193 ms 54972 KB Output is correct
75 Correct 672 ms 63776 KB Output is correct
76 Correct 391 ms 70144 KB Output is correct
77 Correct 421 ms 70184 KB Output is correct
78 Correct 388 ms 70184 KB Output is correct
79 Correct 629 ms 70184 KB Output is correct
80 Correct 366 ms 70184 KB Output is correct
81 Correct 728 ms 70196 KB Output is correct
82 Correct 656 ms 70196 KB Output is correct
83 Correct 680 ms 70196 KB Output is correct
84 Correct 646 ms 70196 KB Output is correct
85 Correct 643 ms 70196 KB Output is correct
86 Correct 666 ms 70196 KB Output is correct
87 Correct 725 ms 70196 KB Output is correct
88 Correct 715 ms 70196 KB Output is correct
89 Correct 716 ms 72116 KB Output is correct
90 Correct 717 ms 72632 KB Output is correct
91 Correct 652 ms 72668 KB Output is correct
92 Correct 656 ms 72808 KB Output is correct
93 Correct 669 ms 73072 KB Output is correct
94 Correct 575 ms 73072 KB Output is correct
95 Correct 607 ms 73072 KB Output is correct
96 Correct 630 ms 73072 KB Output is correct
97 Correct 590 ms 73072 KB Output is correct
98 Correct 489 ms 73588 KB Output is correct
99 Correct 655 ms 80860 KB Output is correct
100 Correct 638 ms 86744 KB Output is correct
101 Correct 552 ms 86744 KB Output is correct
102 Correct 664 ms 86744 KB Output is correct
103 Correct 600 ms 86744 KB Output is correct
104 Correct 637 ms 86744 KB Output is correct
105 Correct 521 ms 86744 KB Output is correct
106 Correct 565 ms 86744 KB Output is correct
107 Correct 540 ms 86744 KB Output is correct
108 Correct 578 ms 86744 KB Output is correct
109 Correct 544 ms 86744 KB Output is correct
110 Correct 578 ms 86744 KB Output is correct
111 Correct 585 ms 86744 KB Output is correct
112 Correct 605 ms 86744 KB Output is correct
113 Correct 583 ms 86744 KB Output is correct
114 Correct 602 ms 86744 KB Output is correct
115 Correct 570 ms 86744 KB Output is correct
116 Correct 618 ms 86744 KB Output is correct