import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.Stack;
import java.util.StringTokenizer;
public class bal {
static class Node{
double x;
double r;
Node(double x, double r){
this.x = x;
this.r = r;
}
}
private static DecimalFormat df = new DecimalFormat("0.000");
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
Stack<Node> s = new Stack<Node>();
for (int i = 0; i < n; i++) {
st = new StringTokenizer(br.readLine());
double curx = Double.parseDouble(st.nextToken()), curr = Double.parseDouble(st.nextToken());
double ans = curr;
while (s.size() > 0){
double newr = 1.0 * (1.0 * (s.peek().x - curx) * (s.peek().x - curx)) / (4.0 * s.peek().r);
curr = Math.min(curr, newr);
if(curr <= s.peek().r){
break;
}
s.pop();
}
System.out.println(df.format(ans));
s.add(new Node(curx, ans));
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
101 ms |
9696 KB |
2nd numbers differ - expected: '4.1670000000', found: '7.0000000000', error = '2.8330000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
107 ms |
9772 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
165 ms |
10016 KB |
2nd numbers differ - expected: '0.0010000000', found: '3.0000000000', error = '2.9990000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
518 ms |
18032 KB |
2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1216 ms |
19308 KB |
2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1520 ms |
20652 KB |
2nd numbers differ - expected: '15398.0000000000', found: '24984.0000000000', error = '9586.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1746 ms |
24476 KB |
2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1913 ms |
25352 KB |
2nd numbers differ - expected: '5059.0000000000', found: '5060.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2066 ms |
27940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2074 ms |
28684 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |