import java.io.*;
import java.util.*;
public class bal {
public static void main(String[] args) throws IOException {
BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer l1 = new StringTokenizer(scan.readLine()); int num = Integer.parseInt(l1.nextToken()); double[][] arr = new double[num][2];
for (int i = 0;i<num;i++) {
StringTokenizer st = new StringTokenizer(scan.readLine());
arr[i][0] = Integer.parseInt(st.nextToken());
arr[i][1] = Integer.parseInt(st.nextToken());
}
Stack<Integer> idx = new Stack<>(); double[] ans = new double[num];
for (int i = 0;i<num;i++) {
while (!idx.isEmpty()) {
int j = idx.peek();
double maxR = Math.pow(arr[i][0]-arr[j][0],2)/(4*ans[j]);
if (maxR>arr[i][1]) {
if (arr[i][1]<=arr[j][1]) {
idx.add(i); ans[i] = arr[i][1];
break;
}
else idx.pop();
} else { //maxR<=arr[i][1]
if (maxR<=arr[j][1]) {
idx.add(i); ans[i] = maxR;
break;
}
else idx.pop();
}
}
if (idx.isEmpty()) ans[i] = arr[i][1];
idx.add(i);
}
for (double i : ans) System.out.println(i+" ");
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
68 ms |
9824 KB |
10 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
72 ms |
9472 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
103 ms |
10120 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
305 ms |
17744 KB |
79th numbers differ - expected: '36.0070000000', found: '1259.4813827325', error = '1223.4743827325' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
744 ms |
21472 KB |
137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1025 ms |
30588 KB |
250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1305 ms |
33408 KB |
162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1290 ms |
35300 KB |
510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1272 ms |
36756 KB |
161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1721 ms |
44492 KB |
248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000' |
2 |
Halted |
0 ms |
0 KB |
- |