int n; double x; int nx[maxn], ny[maxn]; map< pair<int, int>, int>hax; map<int, int>px; vector< pair<int, int> >sta; double ans[maxn];
doubleInsec(pair<int, int> a, pair<int, int>b) { double k = 1.0*(a.second - b.second) / (a.first - b.first); double x = (a.first + b.first) / 2.0; double y = (a.second + b.second) / 2.0;
return x + y*k; }
voidsolve() { sa(n); scanf("%lf", &x); repp(i, 1, n) { int a, b; sa(a), sa(b); if (px.find(a) == px.end() || px[a]>b) { px[a] = b; } hax[mp(a, b)] = i; } for (auto it : px) { while (1) { if (sta.size()<2) { break; } auto a = *(sta.end() - 1); auto b = *(sta.end() - 2); double A = Insec(b, a); double B = Insec(a, it); if (A>B) { sta.pop_back(); } else { break; } } sta.push_back(it); } double left = 0; for (int i = 0; i + 1<sta.size(); i++) { int id = hax[sta[i]]; double now = Insec(sta[i], sta[i + 1]); now = min(now, x); if (now > left) { ans[id] = now - left; } left = max(left, now); } int id = hax[sta[sta.size() - 1]]; double now = Insec(sta[sta.size() - 2], sta[sta.size() - 1]); if (x > now) { ans[id] = x - now; }
for (int i = 1; i <= n; i++) { printf("%.7lf\n", ans[i]); } }