Submission #468632

#TimeUsernameProblemLanguageResultExecution timeMemory
468632VectorizedBalloons (CEOI11_bal)Java
40 / 100
2090 ms24164 KiB
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; } } 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()); while (s.size() > 0){ double newr = 1.0 * (1.0 * (s.peek().x - curx) * (s.peek().x - curx)) / (4.0 * s.peek().r); curr = Math.min(curr, newr); if(curr > s.peek().r){ s.pop(); }else { break; } } System.out.printf("%.3f", curr); System.out.println(); s.add(new Node(curx, curr)); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...