Submission #468627

# Submission time Handle Problem Language Result Execution time Memory
468627 2021-08-29T05:31:51 Z Vectorized Balloons (CEOI11_bal) Java 11
20 / 100
2000 ms 33872 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);
                if(newr < curr){
                    ans = newr;
                    break;
                }
                s.pop();
            }
            System.out.println(df.format(ans));
            s.add(new Node(curx, ans));
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 103 ms 9740 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 101 ms 9808 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 179 ms 10472 KB 12th numbers differ - expected: '5.1130000000', found: '5.3100000000', error = '0.1970000000'
# Verdict Execution time Memory Grader output
1 Incorrect 716 ms 18360 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
# Verdict Execution time Memory Grader output
1 Incorrect 1620 ms 22900 KB 196th numbers differ - expected: '100.7250000000', found: '109.4560000000', error = '8.7310000000'
# Verdict Execution time Memory Grader output
1 Execution timed out 2077 ms 33872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2088 ms 31784 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 28764 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2082 ms 25068 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2078 ms 24516 KB Time limit exceeded
2 Halted 0 ms 0 KB -