# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
468630 |
2021-08-29T05:44:48 Z |
Vectorized |
Balloons (CEOI11_bal) |
Java 11 |
|
2000 ms |
27220 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){
s.pop();
}else {
break;
}
}
System.out.println(df.format(ans));
s.add(new Node(curx, ans));
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
9672 KB |
2nd numbers differ - expected: '4.1670000000', found: '7.0000000000', error = '2.8330000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
98 ms |
10020 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
162 ms |
9936 KB |
2nd numbers differ - expected: '0.0010000000', found: '3.0000000000', error = '2.9990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
509 ms |
18020 KB |
2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1217 ms |
19484 KB |
2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1450 ms |
20716 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 |
1717 ms |
24032 KB |
2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1787 ms |
24536 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 |
2019 ms |
27220 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2075 ms |
27068 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |