# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1067980 |
2024-08-21T06:21:31 Z |
Oz121 |
Mobile (BOI12_mobile) |
Java 11 |
|
580 ms |
69236 KB |
import java.io.*;
import java.util.*;
public class mobile {
public static int num; public static double[][] arr;
public static void main(String[] args) throws IOException {
FastIO io = new FastIO(); num = io.nextInt(); int L = io.nextInt(); arr = new double[num][2];
for (int i = 0;i<num;i++) {
arr[i][0] = io.nextInt(); arr[i][1] = io.nextInt();
}
double l = 0; double h = 2*Math.pow(10,9);
while (h-l>Math.pow(10,-3)) {
double r = (l+h)/2; boolean work = true;
double right = 0;
for (int i = 0;i<num;i++) {
if (r*r-arr[i][1]*arr[i][1]<0) continue;
double sqrt = Math.sqrt(r*r-arr[i][1]*arr[i][1]);
if (arr[i][0]+sqrt<0) continue;
double newL = arr[i][0]-sqrt; double newR = arr[i][0]+sqrt;
if (newL<=right) right = Math.max(right, newR);
}
work = right>=L;
if (work) h = r;
else l = r;
}
io.println((l+h)/2); io.close();
}
public static class FastIO extends PrintWriter {
private InputStream stream;
private byte[] buf = new byte[1 << 16];
private int curChar;
private int numChars;
// standard input
public FastIO() { this(System.in, System.out); }
public FastIO(InputStream i, OutputStream o) {
super(o);
stream = i;
}
public FastIO(String i, String o) throws IOException {
super(new FileWriter(o));
stream = new FileInputStream(i);
}
// throws InputMismatchException() if previously detected end of file
private int nextByte() {
if (numChars == -1) { throw new InputMismatchException(); }
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) { throw new InputMismatchException(); }
if (numChars == -1) {
return -1; // end of file
}
}
return buf[curChar++];
}
public int nextInt() { // nextLong() would be implemented similarly
int c;
do { c = nextByte(); } while (c <= ' ');
int sgn = 1;
if (c == '-') {
sgn = -1;
c = nextByte();
}
int res = 0;
do {
if (c < '0' || c > '9') { throw new InputMismatchException(); }
res = 10 * res + c - '0';
c = nextByte();
} while (c > ' ');
return res * sgn;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
8984 KB |
Output is correct |
2 |
Correct |
55 ms |
8656 KB |
Output is correct |
3 |
Correct |
51 ms |
9236 KB |
Output is correct |
4 |
Correct |
53 ms |
8908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
9156 KB |
Output is correct |
2 |
Correct |
50 ms |
8712 KB |
Output is correct |
3 |
Correct |
53 ms |
9304 KB |
Output is correct |
4 |
Correct |
47 ms |
9100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
9724 KB |
Output is correct |
2 |
Correct |
63 ms |
10312 KB |
Output is correct |
3 |
Correct |
66 ms |
9828 KB |
Output is correct |
4 |
Correct |
69 ms |
9600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
9900 KB |
Output is correct |
2 |
Correct |
75 ms |
9700 KB |
Output is correct |
3 |
Correct |
83 ms |
9460 KB |
Output is correct |
4 |
Correct |
75 ms |
9884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
9968 KB |
Output is correct |
2 |
Correct |
66 ms |
9716 KB |
Output is correct |
3 |
Correct |
69 ms |
9536 KB |
Output is correct |
4 |
Correct |
76 ms |
10068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
9840 KB |
Output is correct |
2 |
Correct |
66 ms |
10212 KB |
Output is correct |
3 |
Correct |
81 ms |
9560 KB |
Output is correct |
4 |
Correct |
82 ms |
9912 KB |
Output is correct |
5 |
Correct |
73 ms |
9748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
116 ms |
13920 KB |
Output is correct |
2 |
Correct |
119 ms |
14928 KB |
Output is correct |
3 |
Correct |
115 ms |
14456 KB |
Output is correct |
4 |
Correct |
114 ms |
14500 KB |
Output is correct |
5 |
Correct |
109 ms |
13752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
14132 KB |
Output is correct |
2 |
Correct |
114 ms |
14140 KB |
Output is correct |
3 |
Correct |
121 ms |
14276 KB |
Output is correct |
4 |
Correct |
114 ms |
14432 KB |
Output is correct |
5 |
Correct |
120 ms |
14920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
105 ms |
15148 KB |
Output is correct |
2 |
Correct |
118 ms |
15072 KB |
Output is correct |
3 |
Correct |
116 ms |
15112 KB |
Output is correct |
4 |
Correct |
118 ms |
17796 KB |
Output is correct |
5 |
Correct |
121 ms |
13996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
18732 KB |
Output is correct |
2 |
Correct |
120 ms |
17836 KB |
Output is correct |
3 |
Correct |
116 ms |
17384 KB |
Output is correct |
4 |
Correct |
125 ms |
17756 KB |
Output is correct |
5 |
Correct |
125 ms |
16968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
17284 KB |
Output is correct |
2 |
Correct |
114 ms |
18008 KB |
Output is correct |
3 |
Correct |
111 ms |
17580 KB |
Output is correct |
4 |
Correct |
118 ms |
17444 KB |
Output is correct |
5 |
Correct |
128 ms |
17340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
232 ms |
35296 KB |
Output is correct |
2 |
Correct |
235 ms |
39060 KB |
Output is correct |
3 |
Correct |
251 ms |
38272 KB |
Output is correct |
4 |
Correct |
250 ms |
39724 KB |
Output is correct |
5 |
Correct |
288 ms |
37196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
258 ms |
38940 KB |
Output is correct |
2 |
Correct |
334 ms |
36900 KB |
Output is correct |
3 |
Correct |
243 ms |
36788 KB |
Output is correct |
4 |
Correct |
251 ms |
39636 KB |
Output is correct |
5 |
Correct |
260 ms |
37648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
242 ms |
37108 KB |
Output is correct |
2 |
Correct |
265 ms |
41384 KB |
Output is correct |
3 |
Correct |
262 ms |
40280 KB |
Output is correct |
4 |
Correct |
295 ms |
42828 KB |
Output is correct |
5 |
Correct |
297 ms |
39260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
263 ms |
41556 KB |
Output is correct |
2 |
Correct |
385 ms |
38912 KB |
Output is correct |
3 |
Correct |
244 ms |
38836 KB |
Output is correct |
4 |
Correct |
280 ms |
42692 KB |
Output is correct |
5 |
Correct |
295 ms |
39696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
303 ms |
41292 KB |
Output is correct |
2 |
Correct |
279 ms |
46152 KB |
Output is correct |
3 |
Correct |
282 ms |
45448 KB |
Output is correct |
4 |
Correct |
320 ms |
47800 KB |
Output is correct |
5 |
Correct |
351 ms |
43288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
280 ms |
46636 KB |
Output is correct |
2 |
Correct |
413 ms |
43652 KB |
Output is correct |
3 |
Correct |
280 ms |
43580 KB |
Output is correct |
4 |
Correct |
303 ms |
47556 KB |
Output is correct |
5 |
Correct |
318 ms |
44468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
351 ms |
54332 KB |
Output is correct |
2 |
Correct |
321 ms |
59984 KB |
Output is correct |
3 |
Correct |
355 ms |
58892 KB |
Output is correct |
4 |
Correct |
361 ms |
62160 KB |
Output is correct |
5 |
Correct |
375 ms |
57836 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
337 ms |
60448 KB |
Output is correct |
2 |
Correct |
472 ms |
57128 KB |
Output is correct |
3 |
Correct |
383 ms |
57320 KB |
Output is correct |
4 |
Correct |
355 ms |
62124 KB |
Output is correct |
5 |
Correct |
406 ms |
58084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
420 ms |
59528 KB |
Output is correct |
2 |
Correct |
391 ms |
66492 KB |
Output is correct |
3 |
Correct |
408 ms |
65436 KB |
Output is correct |
4 |
Correct |
477 ms |
69236 KB |
Output is correct |
5 |
Correct |
466 ms |
63572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
438 ms |
67200 KB |
Output is correct |
2 |
Correct |
580 ms |
63144 KB |
Output is correct |
3 |
Correct |
416 ms |
63112 KB |
Output is correct |
4 |
Correct |
458 ms |
69088 KB |
Output is correct |
5 |
Correct |
485 ms |
64580 KB |
Output is correct |