Submission #1066718

#TimeUsernameProblemLanguageResultExecution timeMemory
1066718Oz121Mobile (BOI12_mobile)Java
Compilation error
0 ms0 KiB
import java.io.*; import java.util.*; public class M=mobile { public static int num; public static double[][] arr; public static void main(String[] args) throws IOException { BufferedReader scan = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer l1 = new StringTokenizer(scan.readLine()); num = Integer.parseInt(l1.nextToken()); int L = Integer.parseInt(l1.nextToken()); arr = new double[num][2]; for (int i = 0;i<num;i++) { StringTokenizer st = new StringTokenizer(scan.readLine()); arr[i][0] = Integer.parseInt(st.nextToken()); arr[i][1] = Integer.parseInt(st.nextToken()); } double l = 0; double h = Math.pow(10,9); while (h-l>Math.pow(10,-3)) { double mid = (l+h)/2; boolean work = true; double[][] endpoints = getEndpoints(mid); Arrays.sort(endpoints, (i,j)->Double.compare(i[0],j[0])); /*System.out.println(" "+mid); for (int i = 0;i<num;i++) { System.out.println(endpoints[i][0]+" "+endpoints[i][1]); } System.out.println("--------");*/ double left = endpoints[0][0]; double right = endpoints[0][1]; for (int i = 1;i<num;i++) { if (endpoints[i][0]>right) work = false; left = Math.min(left, endpoints[i][0]); right = Math.max(right, endpoints[i][1]); } work = (work)&&(left<=0&&right>=L); if (work) h = mid; else l = mid; } System.out.println((l+h)/2); } public static double[][] getEndpoints (double r) { double[][] endpoints = new double[num][2]; for (int i = 0;i<num;i++) { endpoints[i][0] = arr[i][0]-Math.sqrt(r*r-arr[i][1]*arr[i][1]); endpoints[i][1] = arr[i][0]+Math.sqrt(r*r-arr[i][1]*arr[i][1]); } return endpoints; } }

Compilation message (stderr)

mobile.java:3: error: '{' expected
public class M=mobile {
              ^
1 error