이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |