답안 #448082

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
448082 2021-07-28T18:05:29 Z mnair797 Mobile (BOI12_mobile) Java 11
50 / 100
1000 ms 83948 KB
import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
 
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());
 
        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)); 
    }
}
 
 
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);
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 126 ms 14332 KB Output is correct
2 Correct 105 ms 13564 KB Output is correct
3 Correct 104 ms 13784 KB Output is correct
4 Correct 105 ms 13796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 112 ms 13724 KB Output is correct
2 Correct 108 ms 13828 KB Output is correct
3 Correct 109 ms 13516 KB Output is correct
4 Correct 107 ms 13820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 254 ms 17352 KB Output is correct
2 Correct 250 ms 17272 KB Output is correct
3 Correct 204 ms 15828 KB Output is correct
4 Correct 244 ms 17564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 293 ms 18976 KB Output is correct
2 Correct 297 ms 18816 KB Output is correct
3 Correct 310 ms 18924 KB Output is correct
4 Correct 295 ms 18928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 294 ms 18964 KB Output is correct
2 Correct 294 ms 19104 KB Output is correct
3 Correct 298 ms 19056 KB Output is correct
4 Correct 352 ms 19072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 296 ms 18796 KB Output is correct
2 Correct 303 ms 18844 KB Output is correct
3 Correct 289 ms 18964 KB Output is correct
4 Correct 285 ms 18984 KB Output is correct
5 Correct 293 ms 18836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 459 ms 23024 KB Output is correct
2 Correct 496 ms 24844 KB Output is correct
3 Correct 430 ms 21248 KB Output is correct
4 Correct 426 ms 23288 KB Output is correct
5 Correct 418 ms 20620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 487 ms 24204 KB Output is correct
2 Correct 424 ms 22736 KB Output is correct
3 Correct 435 ms 23952 KB Output is correct
4 Correct 418 ms 24456 KB Output is correct
5 Correct 432 ms 24484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 560 ms 24040 KB Output is correct
2 Correct 500 ms 24532 KB Output is correct
3 Correct 485 ms 24328 KB Output is correct
4 Correct 442 ms 26100 KB Output is correct
5 Correct 514 ms 24224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 540 ms 25264 KB Output is correct
2 Correct 523 ms 25324 KB Output is correct
3 Correct 516 ms 25236 KB Output is correct
4 Correct 438 ms 25804 KB Output is correct
5 Correct 470 ms 24928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 599 ms 25300 KB Output is correct
2 Correct 531 ms 25576 KB Output is correct
3 Correct 523 ms 25228 KB Output is correct
4 Correct 430 ms 25800 KB Output is correct
5 Correct 461 ms 24988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 46404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1100 ms 51240 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 51844 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 57544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 56200 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 62464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 60232 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 67212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 73500 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1090 ms 83948 KB Time limit exceeded
2 Halted 0 ms 0 KB -