# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1066699 |
2024-08-20T05:05:23 Z |
Oz121 |
Balloons (CEOI11_bal) |
Java 11 |
|
1765 ms |
39988 KB |
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++) {
double newR = arr[i][1];
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]<=ans[j]) {
idx.add(i); break;
}
else idx.pop();
} else { //maxR<=arr[i][1]
newR = Math.min(newR, maxR);
if (maxR<=ans[j]) {
idx.add(i);
break;
}
else idx.pop();
}
}
ans[i] = newR;
idx.add(i);
}
for (double i : ans) System.out.println(i+" ");
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
10096 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
10020 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
10512 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
17208 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
768 ms |
20788 KB |
3437th numbers differ - expected: '298.4460000000', found: '304.0000000000', error = '5.5540000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1225 ms |
35856 KB |
50000 numbers |
2 |
Correct |
728 ms |
20100 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1382 ms |
36444 KB |
14857th numbers differ - expected: '7169.6020000000', found: '7176.0000000000', error = '6.3980000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1209 ms |
32656 KB |
115362 numbers |
2 |
Correct |
963 ms |
27356 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1422 ms |
34904 KB |
109914th numbers differ - expected: '1404.0970000000', found: '1415.0000000000', error = '10.9030000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1765 ms |
39988 KB |
8510th numbers differ - expected: '318.4980000000', found: '320.0000000000', error = '1.5020000000' |
2 |
Halted |
0 ms |
0 KB |
- |