Submission #1066688

# Submission time Handle Problem Language Result Execution time Memory
1066688 2024-08-20T04:55:53 Z Oz121 Balloons (CEOI11_bal) Java 11
10 / 100
1892 ms 44756 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++) {
            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); ans[i] = arr[i][1];
                        break;
                    }
                    else idx.pop();
                } else { //maxR<=arr[i][1]
                    if (maxR<=ans[j]) {
                        idx.add(i); ans[i] = maxR;
                        break;
                    }
                    else idx.pop();
                }
            }

            if (idx.isEmpty()) ans[i] = arr[i][1];
            idx.add(i);
        }

        for (double i : ans) System.out.println(i+" ");
    }
}
# Verdict Execution time Memory Grader output
1 Correct 71 ms 10044 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 9728 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 109 ms 10480 KB 14th numbers differ - expected: '2.6090000000', found: '7.1408450704', error = '4.5318450704'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 316 ms 16976 KB 79th numbers differ - expected: '36.0070000000', found: '2766.0000000000', error = '2729.9930000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 747 ms 21396 KB 137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1100 ms 32028 KB 250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1319 ms 35296 KB 162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1199 ms 32280 KB 510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1321 ms 35124 KB 161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1892 ms 44756 KB 248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000'
2 Halted 0 ms 0 KB -