#include #include #include static int n; struct ciara { double a, b, c; }; static struct ciara *c; void setciara(int now, int from, int to, int what, double kolko) { int mid=(from+to)/2; if(from==to) c[now].b=kolko; else if(what<=mid) { setciara(2*now, from, mid, what, kolko); c[now].b=c[2*now].b+c[2*now+1].b; } else { setciara(2*now+1, mid+1, to, what, kolko); c[now].b=c[2*now].b+c[2*now+1].b; } } double ga(int now, int from, int to, int what) { int mid=(from+to)/2; if(from==to) return c[now].c; else if(what<=mid) return ga(2*now, from, mid, what); else return ga(2*now+1, mid+1, to, what); } void update(int now, int from, int to, int what, double uhol) { int mid=(from+to)/2; double a, b, cc, uh; if(from==to) { c[now].a=uhol-ga(1, 0, n-1, what-1); return; } if(what<=mid) update(2*now, from, mid, what, uhol); else update(2*now+1, mid+1, to, what, uhol); a=c[2*now].b; b=c[2*now+1].b*cos(c[2*now].c+c[2*now+1].a); cc=c[2*now+1].b*sin(c[2*now].c+c[2*now+1].a); uh=atan2(cc, a+b); c[now].a=c[2*now].a+uh; c[now].c=c[2*now].a+c[2*now].c+c[2*now+1].a+c[2*now+1].c-c[now].a; c[now].b=sqrt((a+b)*(a+b)+cc*cc); } int main() { int cc; int blank=0; c=malloc(sizeof(struct ciara)*50000); memset(c, 0, sizeof(struct ciara)*50000); while(scanf("%d %d ", &n, &cc)==2) { int i; memset(c, 0, sizeof(struct ciara)*50000); for(i=0; i