Submission #1129921

#TimeUsernameProblemLanguageResultExecution timeMemory
1129921APersonMobile (BOI12_mobile)Java
25 / 100
1105 ms177004 KiB
import java.util.*; public class mobile { static int n, l; static Point[] p; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); l = sc.nextInt(); p = new Point[n]; for(int i = 0; i < n; i++) p[i] = new Point(sc.nextDouble(), sc.nextDouble()); double min = 0; double max = 1e10; while(max-min > 1e-3) { double mid = (max+min)/2; if(works(mid)) max = mid; else min = mid; } System.out.println(min); sc.close(); } public static boolean works(double x) { double last = 0; for(int i = 0; i < n; i++) { double xDist = Math.sqrt(x*x-p[i].y*p[i].y); double l = p[i].x-xDist; double r = p[i].x+xDist; if(l < last) last = Math.max(last, r); } return last >= l; } public static class Point { double x, y; public Point(double x, double y) { this.x = x; this.y = Math.abs(y); } } }
#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...