Esempio n. 1
0
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  const double pi = 2 * acos(0.0);

  while (scanf("%d%d", &N, &C) != EOF) {
    REP(i, N) scanf("%d", L+i);
    REP(i, C) scanf("%d%d", S+i, A+i);

    double prv[10000];

    SegmentTree T;
    T.init(0,0,N);
    for (int i = 1; i < N; ++i) prv[i] = pi;

    REP(i, C) {
      int s = S[i];
      double a = (A[i] / 360.0) * 2 * pi;
      T.change(s, a-prv[s], 0, 0, N);
      prv[s] = a;
      printf("%.2f %.2f\n", T.vx[0], T.vy[0]);
    }
    puts("");
  }
void HLD::change(int pos, int val)
{
	pos=(pos-1)*2;
	int u=G->u[pos], v=G->v[pos];
	if(dept[u]>dept[v]) swap(u,v);
	tree.change(1,dfsn[v],val);
}