# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
468629 |
2021-08-29T05:40:06 Z |
Vectorized |
Balloons (CEOI11_bal) |
Java 11 |
|
2000 ms |
27024 KB |
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));
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
134 ms |
9596 KB |
2nd numbers differ - expected: '4.1670000000', found: '7.0000000000', error = '2.8330000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
9700 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
163 ms |
10084 KB |
2nd numbers differ - expected: '0.0010000000', found: '3.0000000000', error = '2.9990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
522 ms |
17960 KB |
2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1182 ms |
19220 KB |
2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1459 ms |
20676 KB |
2nd numbers differ - expected: '15398.0000000000', found: '24984.0000000000', error = '9586.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1741 ms |
23764 KB |
2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1822 ms |
24232 KB |
2nd numbers differ - expected: '5059.0000000000', found: '5060.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2061 ms |
26876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2081 ms |
27024 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |