import java.util.*;
import java.io.*;
public class bal {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
int N = Integer.parseInt(br.readLine());
Bal [] b = new Bal[N];
for (int i=0;i<N;i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
b[i] = new Bal(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
}
Deque<Integer> s = new ArrayDeque<>();
for (int i=0;i<N;i++) {
while (!s.isEmpty()) {
Bal c = b[s.peek()];
double rLim = Math.pow(b[i].x-b[s.peek()].x ,2)/(4*b[s.peek()].r);
b[i].r = Math.min(b[i].r, rLim);
if (b[i].r>=c.r) {s.pop(); continue;}
else break;
}
s.push(i);
}
for (Bal a : b) {
pw.printf("%.3f\n", a.r);
}
pw.close();
}
static class Bal {
int x;
double r;
int rmax;
public Bal(int x, int rmax) {
this.x = x;
this.rmax = rmax;
r = rmax;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |