답안 #998504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
998504 2024-06-14T05:27:48 Z sushikid Mobile (BOI12_mobile) Java 11
90 / 100
1000 ms 100384 KB
import java.util.*;
import java.io.*;

public class mobile {
    private static double[][] 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(double[] 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 double[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();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 52 ms 18444 KB Output is correct
2 Correct 46 ms 14572 KB Output is correct
3 Correct 48 ms 14772 KB Output is correct
4 Correct 46 ms 12512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 12416 KB Output is correct
2 Correct 53 ms 12296 KB Output is correct
3 Correct 55 ms 10432 KB Output is correct
4 Correct 56 ms 14748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 125 ms 18872 KB Output is correct
2 Correct 140 ms 19924 KB Output is correct
3 Correct 101 ms 17664 KB Output is correct
4 Correct 137 ms 19876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 148 ms 17912 KB Output is correct
2 Correct 163 ms 22004 KB Output is correct
3 Correct 158 ms 24080 KB Output is correct
4 Correct 157 ms 22188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 149 ms 17672 KB Output is correct
2 Correct 166 ms 24140 KB Output is correct
3 Correct 158 ms 24192 KB Output is correct
4 Correct 173 ms 24380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 23744 KB Output is correct
2 Correct 162 ms 24116 KB Output is correct
3 Correct 157 ms 24388 KB Output is correct
4 Correct 154 ms 26028 KB Output is correct
5 Correct 144 ms 24036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 269 ms 29376 KB Output is correct
2 Correct 227 ms 33228 KB Output is correct
3 Correct 206 ms 30400 KB Output is correct
4 Correct 220 ms 32624 KB Output is correct
5 Correct 196 ms 29068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 233 ms 27224 KB Output is correct
2 Correct 206 ms 29304 KB Output is correct
3 Correct 220 ms 27004 KB Output is correct
4 Correct 213 ms 30464 KB Output is correct
5 Correct 223 ms 30900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 242 ms 30184 KB Output is correct
2 Correct 237 ms 31464 KB Output is correct
3 Correct 235 ms 30720 KB Output is correct
4 Correct 231 ms 31456 KB Output is correct
5 Correct 249 ms 28772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 249 ms 30256 KB Output is correct
2 Correct 243 ms 30676 KB Output is correct
3 Correct 235 ms 32948 KB Output is correct
4 Correct 231 ms 31812 KB Output is correct
5 Correct 233 ms 32556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 261 ms 30060 KB Output is correct
2 Correct 239 ms 32036 KB Output is correct
3 Correct 234 ms 32744 KB Output is correct
4 Correct 230 ms 32336 KB Output is correct
5 Correct 226 ms 32740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 448 ms 53524 KB Output is correct
2 Correct 497 ms 52904 KB Output is correct
3 Correct 473 ms 60892 KB Output is correct
4 Correct 489 ms 64680 KB Output is correct
5 Correct 471 ms 61500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 472 ms 53384 KB Output is correct
2 Correct 841 ms 59892 KB Output is correct
3 Correct 452 ms 58812 KB Output is correct
4 Correct 504 ms 63812 KB Output is correct
5 Correct 472 ms 60056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 497 ms 55732 KB Output is correct
2 Correct 530 ms 50040 KB Output is correct
3 Correct 521 ms 60516 KB Output is correct
4 Correct 543 ms 63716 KB Output is correct
5 Correct 542 ms 57564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 524 ms 54072 KB Output is correct
2 Correct 900 ms 62068 KB Output is correct
3 Correct 504 ms 58944 KB Output is correct
4 Correct 541 ms 65704 KB Output is correct
5 Correct 531 ms 62548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 540 ms 58108 KB Output is correct
2 Correct 577 ms 58580 KB Output is correct
3 Correct 598 ms 68088 KB Output is correct
4 Correct 610 ms 71508 KB Output is correct
5 Correct 582 ms 69360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 583 ms 60368 KB Output is correct
2 Correct 996 ms 69300 KB Output is correct
3 Correct 544 ms 68604 KB Output is correct
4 Correct 586 ms 71656 KB Output is correct
5 Correct 593 ms 70660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 619 ms 70268 KB Output is correct
2 Correct 660 ms 69640 KB Output is correct
3 Correct 668 ms 83360 KB Output is correct
4 Correct 682 ms 85300 KB Output is correct
5 Correct 651 ms 81336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 668 ms 71976 KB Output is correct
2 Execution timed out 1014 ms 84364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 709 ms 81612 KB Output is correct
2 Correct 757 ms 82020 KB Output is correct
3 Correct 754 ms 96488 KB Output is correct
4 Correct 834 ms 100384 KB Output is correct
5 Correct 783 ms 93060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 758 ms 88176 KB Output is correct
2 Execution timed out 1050 ms 92648 KB Time limit exceeded
3 Halted 0 ms 0 KB -