Submission #468626

#TimeUsernameProblemLanguageResultExecution timeMemory
468626VectorizedBalloons (CEOI11_bal)Java
20 / 100
2087 ms34460 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; } } 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 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...