This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.util.*;
import java.io.*;
public class bal {
public static void main(String[] args) throws IOException{
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
StringBuilder sb = new StringBuilder();
int n = Integer.parseInt(r.readLine());
Stack<double[]> cur = new Stack<>();
for (int i = 0; i < n; i++) {
StringTokenizer st = new StringTokenizer(r.readLine());
int x = Integer.parseInt(st.nextToken()); double rad = Integer.parseInt(st.nextToken());
while(!cur.isEmpty()){
rad = Math.min(rad, (double)(cur.peek()[0] - x) * (cur.peek()[0] - x)/(4 * cur.peek()[1]));
if(cur.peek()[1] <= rad){
cur.pop();
}
else{
break;
}
}
sb.append(rad).append('\n');
cur.add(new double[]{x, rad});
}
sb.deleteCharAt(sb.length() - 1);
pw.println(sb);
pw.close();
}
}
# | 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... |