Submission #310096

#TimeUsernameProblemLanguageResultExecution timeMemory
310096TruaShamuMobile (BOI12_mobile)Java
50 / 100
1096 ms131072 KiB
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.text.DecimalFormat; import java.util.StringTokenizer; public class mobile { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); Point[] p = new Point[1000000]; int N = Integer.parseInt(st.nextToken()); int length = Integer.parseInt(st.nextToken()); //Read in points for (int i = 0; i < N; i++) { st = new StringTokenizer(br.readLine()); long x = Integer.parseInt(st.nextToken()); long y = Integer.parseInt(st.nextToken()); p[i] = (new Point(x, y)); } double left = 1, right = 5e8; while (right - left > 1e-3) { double mid = (left + right) / 2; double curr = 0; for (int i = 0; i < N; i++) { double delta = Math.pow(mid * mid - p[i].y * p[i].y, 0.5); //(sqrt) double a = p[i].x - delta; double b = p[i].x + delta; if (a <= curr) { curr = Double.max(curr, b); } } if (curr >= length) { right = mid; } else { left = mid; } } DecimalFormat df = new DecimalFormat("#.#######"); System.out.println(df.format(left)); //System.out.println(left); } } class Point implements Comparable<Point> { public long x, y; public Point(long x, long y) { this.x = x; this.y = y; } public int compareTo(Point other) { if (this.x != other.x) { return Long.compare(this.x, other.x); } else { return Long.compare(other.y, this.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...