# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
468632 |
2021-08-29T05:48:31 Z |
Vectorized |
Balloons (CEOI11_bal) |
Java 11 |
|
2000 ms |
24164 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;
}
}
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());
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.printf("%.3f", curr);
System.out.println();
s.add(new Node(curx, curr));
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
9388 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
103 ms |
9260 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
202 ms |
10172 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
809 ms |
19132 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2069 ms |
21700 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2054 ms |
23904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2090 ms |
24164 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2075 ms |
23372 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2068 ms |
21168 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2077 ms |
23760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |