Submission #998503

#TimeUsernameProblemLanguageResultExecution timeMemory
998503sushikidMobile (BOI12_mobile)Java
12 / 100
823 ms85904 KiB
import java.util.*; import java.io.*; public class mobile { private static int[][] info; private static int l; private static boolean check(double rad){ double max = 0; for (int i = 0; i < info.length; i++) { double[] intersect = intersect(info[i], rad); if(intersect[0] <= max){ max = Math.max(max, intersect[1]); } } return max >= l; } private static double[] intersect(int[] point, double rad){ double change = Math.sqrt(rad * rad - point[1] * point[1]); return new double[]{point[0] - change, point[0] + change}; } public static void main(String[] args) throws IOException{ BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(r.readLine()); int n = Integer.parseInt(st.nextToken()); l = Integer.parseInt(st.nextToken()); info = new int[n][2]; for (int i = 0; i < n; i++) { st = new StringTokenizer(r.readLine()); info[i][0] = Integer.parseInt(st.nextToken()); info[i][1] = Integer.parseInt(st.nextToken()); } double left = 0; double right = l; for (int i = 0; i < 100; i++) { double mid = left + (right - left)/2; if(check(mid)){ right = mid; } else{ left = mid; } } pw.println(left); 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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...