Submission #577065

#TimeUsernameProblemLanguageResultExecution timeMemory
577065BenqtBalloons (CEOI11_bal)Java
Compilation error
0 ms0 KiB
import java.io.*; import java.util.*; public class ballonsJavabrowtf { public static void main(String[] args) throws IOException { Kattio io = new Kattio(); int n = io.nextInt(); double[][] arr = new double[n][2]; for (int i=0; i<n; i++) { arr[i][0] = io.nextDouble(); arr[i][1] = io.nextDouble(); } Stack<double[]> st = new Stack<>(); for (int i=0; i<n; i++) { while (!st.isEmpty()) { double[] cur = st.peek(); double h = arr[i][0] - cur[0]; double r = (h * h)/(4 * cur[1]); arr[i][1] = Math.min(arr[i][1], r); if (r >= cur[1]) { st.pop(); } else { break; } } st.add(arr[i]); io.println(arr[i][1]); } io.close(); } static class Kattio extends PrintWriter { private BufferedReader r; private StringTokenizer st; // standard input public Kattio() { this(System.in, System.out); } public Kattio(InputStream i, OutputStream o) { super(o); r = new BufferedReader(new InputStreamReader(i)); } // USACO-style file input public Kattio(String problemName) throws IOException { super(new FileWriter(problemName + ".out")); r = new BufferedReader(new FileReader(problemName + ".in")); } // returns null if no more input public String next() { try { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(r.readLine()); return st.nextToken(); } catch (Exception e) { } return null; } public int nextInt() { return Integer.parseInt(next()); } public double nextDouble() { return Double.parseDouble(next()); } public long nextLong() { return Long.parseLong(next()); } } }

Compilation message (stderr)

bal.java:4: error: class ballonsJavabrowtf is public, should be declared in a file named ballonsJavabrowtf.java
public class ballonsJavabrowtf {
       ^
1 error