Submission #605827

# Submission time Handle Problem Language Result Execution time Memory
605827 2022-07-26T03:04:07 Z bzhu524 Mobile (BOI12_mobile) Java 11
0 / 100
460 ms 14112 KB
import java.util.*;
import java.io.*;


public class mobile {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        StringTokenizer l1 = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(l1.nextToken());
        int len = Integer.parseInt(l1.nextToken());
//        Point[] points = new Point[n];
//        for (int i=0; i<n; i++) {
//            StringTokenizer st = new StringTokenizer(br.readLine());
//            long x = Long.parseLong(st.nextToken());
//            long y = Long.parseLong(st.nextToken());
//            points[i] = new Point(x, y);
//        }

        double lower = 1;
        double upper = 1000000000;
        
        while (upper - lower > 1e-3) {
            double mid = (upper + lower) / 2;
            double currPoint = 0;
            for (int i=0; i<n; i++) { // remove this loop for faster solution
                StringTokenizer st = new StringTokenizer(br.readLine());

                long x = Long.parseLong(st.nextToken());
                long y = Long.parseLong(st.nextToken());

                double delta = Math.sqrt(mid * mid - y * y);
                double p1 = x - delta;
                double p2 = x + delta;

                if (p1 <= currPoint) {
                    currPoint = Math.max(currPoint, p2);
                }
            }
            if (currPoint < len) {
                lower = mid;
            } else {
                upper = mid;
            }
        }

        String r = String.format("%.6f", lower);
        System.out.println(r);
    }

//    static class Point {
//        long x;
//        long y;
//        public Point(long x, long y) {
//            this.x = x;
//            this.y = y;
//        }
//    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 8288 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 67 ms 8216 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 169 ms 11828 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 187 ms 12312 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 239 ms 12276 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 187 ms 12316 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 239 ms 13876 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 306 ms 13916 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 272 ms 13880 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 237 ms 13872 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 287 ms 13872 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 323 ms 13868 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 354 ms 14112 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 343 ms 13804 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 373 ms 13852 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 401 ms 13636 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 412 ms 13784 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 413 ms 13844 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 421 ms 13944 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 460 ms 13728 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 455 ms 13716 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -