Submission #468626

# Submission time Handle Problem Language Result Execution time Memory
468626 2021-08-29T05:19:43 Z Vectorized Balloons (CEOI11_bal) Java 11
20 / 100
2000 ms 34460 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 = ((s.peek().x - curx) * (s.peek().x - curx)) / (4f * 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 109 ms 9784 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 101 ms 9940 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 178 ms 10248 KB 12th numbers differ - expected: '5.1130000000', found: '5.3100000000', error = '0.1970000000'
# Verdict Execution time Memory Grader output
1 Incorrect 726 ms 18392 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
# Verdict Execution time Memory Grader output
1 Incorrect 1644 ms 22924 KB 196th numbers differ - expected: '100.7250000000', found: '109.4560000000', error = '8.7310000000'
# Verdict Execution time Memory Grader output
1 Execution timed out 2070 ms 34460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2069 ms 32052 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2087 ms 25836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2073 ms 25744 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2079 ms 25104 KB Time limit exceeded
2 Halted 0 ms 0 KB -