Submission #480699

# Submission time Handle Problem Language Result Execution time Memory
480699 2021-10-17T22:09:55 Z Toinfinity1 Balloons (CEOI11_bal) Java 11
0 / 100
1587 ms 44796 KB
import java.io.*;
import java.util.*;

public class bal
{
	static class InputReader {
		BufferedReader reader;
		StringTokenizer tokenizer;
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		String next() { // reads in the next string
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() { // reads in the next int
			return Integer.parseInt(next());
		}
		public long nextLong() { // reads in the next long
			return Long.parseLong(next());
		}
		public double nextDouble() { // reads in the next double
			return Double.parseDouble(next());
			}
		}
	static InputReader r = new InputReader(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args)
	{
		int n = r.nextInt();
		double[] rad = new double[n];
		double[] x = new double[n];
		Stack<Integer> stack = new Stack<Integer>();
		for (int i = 0; i < n; i ++)
		{
			double a = r.nextDouble();
			double b = r.nextDouble();
			double last = 0.0;
			while (!stack.isEmpty() && (rad[stack.peek()] <= b || last <= b))
			{
				double ra = rad[stack.peek()];
				double lo = x[stack.peek()];
				b = Math.min(b, ((a-lo)*(a-lo))/(4*ra));
				last = ra;
				if (b >= ra)
				{
					stack.pop();
				}
			}
			x[i] = a;
			rad[i] = b;
			stack.add(i);
		}
		pw.println(Arrays.toString(rad));
		pw.close();
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 8960 KB Expected double, but "[24.0," found
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 8604 KB Expected double, but "[2.47294217E8," found
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 8796 KB Expected double, but "[213.0," found
# Verdict Execution time Memory Grader output
1 Incorrect 433 ms 15852 KB Expected double, but "[123.0," found
# Verdict Execution time Memory Grader output
1 Incorrect 898 ms 19492 KB Expected double, but "[213.0," found
# Verdict Execution time Memory Grader output
1 Incorrect 1514 ms 35832 KB Expected double, but "[15399.0," found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1587 ms 37216 KB Expected double, but "[7938.0," found
# Verdict Execution time Memory Grader output
1 Incorrect 1156 ms 32028 KB Expected double, but "[5060.0," found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1241 ms 36620 KB Expected double, but "[1874.0," found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1584 ms 44796 KB Expected double, but "[2962.0," found
2 Halted 0 ms 0 KB -