제출 #817908

#제출 시각아이디문제언어결과실행 시간메모리
817908sushikidBalloons (CEOI11_bal)Java
100 / 100
992 ms39520 KiB
import java.util.*; import java.io.*; public class bal { public static void main(String[] args) throws IOException{ BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(r.readLine()); Stack<double[]> cur = new Stack<>(); for (int i = 0; i < n; i++) { StringTokenizer st = new StringTokenizer(r.readLine()); int x = Integer.parseInt(st.nextToken()); double rad = Integer.parseInt(st.nextToken()); while(!cur.isEmpty()){ rad = Math.min(rad, (double)(cur.peek()[0] - x) * (cur.peek()[0] - x)/(4 * cur.peek()[1])); if(cur.peek()[1] <= rad){ cur.pop(); } else{ break; } } sb.append(rad).append('\n'); cur.add(new double[]{x, rad}); } sb.deleteCharAt(sb.length() - 1); pw.println(sb); pw.close(); } }
#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...