Submission #998503

# Submission time Handle Problem Language Result Execution time Memory
998503 2024-06-14T05:24:48 Z sushikid Mobile (BOI12_mobile) Java 11
12 / 100
823 ms 85904 KB
import java.util.*;
import java.io.*;

public class mobile {
    private static int[][] 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(int[] 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 int[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();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 47 ms 22404 KB Output is correct
2 Correct 48 ms 14456 KB Output is correct
3 Correct 48 ms 12008 KB Output is correct
4 Correct 47 ms 10516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 14708 KB Output is correct
2 Correct 55 ms 14184 KB Output is correct
3 Correct 55 ms 18672 KB Output is correct
4 Correct 55 ms 16188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 122 ms 17432 KB Output is correct
2 Correct 132 ms 21308 KB Output is correct
3 Correct 100 ms 19996 KB Output is correct
4 Correct 130 ms 21192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 152 ms 19640 KB Output is correct
2 Correct 166 ms 17904 KB Output is correct
3 Correct 157 ms 16020 KB Output is correct
4 Incorrect 160 ms 20236 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 149 ms 19804 KB Output is correct
2 Correct 162 ms 23784 KB Output is correct
3 Correct 159 ms 23640 KB Output is correct
4 Incorrect 179 ms 26396 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 156 ms 26024 KB Output is correct
2 Correct 164 ms 23888 KB Output is correct
3 Correct 158 ms 23788 KB Output is correct
4 Incorrect 159 ms 26016 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 261 ms 27304 KB Output is correct
2 Incorrect 222 ms 29680 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 242 ms 29164 KB Output is correct
2 Correct 209 ms 24928 KB Output is correct
3 Incorrect 296 ms 23416 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 247 ms 25904 KB Output is correct
2 Incorrect 235 ms 26052 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 243 ms 27100 KB Output is correct
2 Incorrect 248 ms 24956 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 251 ms 27040 KB Output is correct
2 Incorrect 246 ms 26756 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 455 ms 47768 KB Output is correct
2 Incorrect 501 ms 49036 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 514 ms 51460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 495 ms 48396 KB Output is correct
2 Incorrect 509 ms 56544 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 579 ms 57156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 544 ms 56528 KB Output is correct
2 Incorrect 587 ms 65852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 627 ms 66136 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 599 ms 63100 KB Output is correct
2 Incorrect 641 ms 68508 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 634 ms 71128 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 716 ms 77140 KB Output is correct
2 Incorrect 778 ms 85904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 823 ms 82868 KB Output isn't correct
2 Halted 0 ms 0 KB -