이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
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... |