# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
698215 |
2023-02-12T21:18:41 Z |
randmac |
Mobile (BOI12_mobile) |
C++14 |
|
276 ms |
8500 KB |
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;
// https://oj.uz/problem/view/BOI12_mobile
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("mobile.in", "r", stdin);
// freopen("mobile.out", "w", stdout);
int N, L;
cin >> N >> L;
vector<pair<int, int>> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i].first >> a[i].second;
}
// double ans = -1;
// for (int i = 0; i < b.size() - 1; i++) {
// int x_sum = b[i].first + b[i + 1].first;
// int x_diff = b[i + 1].first - b[i].first;
// double y_squared = (b[i + 1].second + b[i].second) * (b[i + 1].second - b[i].second);
// double x_0 = ( y_squared / x_diff + x_sum) / 2;
// double distance = (b[i].first - x_0) * (b[i].first - x_0) + b[i].second * b[i].second;
// ans = max(ans, distance);
// }
double low = 1, high = 1.5e9;
while (high - low > 1e-3) {
double mid = low + (high - low) / 2, curr = 0;
for (int i = 0; i < N; i++) {
double delta = sqrt(mid * mid - a[i].second * a[i].second);
double left = a[i].first - delta, right = a[i].first + delta;
if (left <= curr) curr = max(curr, right);
}
if (curr >= L) high = mid;
else low = mid;
}
// cout << sqrt(ans) << setprecision(4) << endl;
cout << fixed << setprecision(4) << low << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
240 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
360 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
428 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
3 ms |
436 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
3 ms |
320 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
420 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
328 KB |
Output is correct |
4 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
976 KB |
Output is correct |
2 |
Incorrect |
21 ms |
1032 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1108 KB |
Output is correct |
2 |
Correct |
22 ms |
1620 KB |
Output is correct |
3 |
Incorrect |
41 ms |
1864 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1108 KB |
Output is correct |
2 |
Incorrect |
23 ms |
980 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1236 KB |
Output is correct |
2 |
Incorrect |
28 ms |
2500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
1360 KB |
Output is correct |
2 |
Incorrect |
29 ms |
1364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
116 ms |
4376 KB |
Output is correct |
2 |
Incorrect |
139 ms |
4472 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
143 ms |
4480 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
5192 KB |
Output is correct |
2 |
Incorrect |
164 ms |
5260 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
178 ms |
5308 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
163 ms |
6164 KB |
Output is correct |
2 |
Incorrect |
200 ms |
6044 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
197 ms |
6052 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
6836 KB |
Output is correct |
2 |
Incorrect |
214 ms |
6816 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
224 ms |
6732 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
8400 KB |
Output is correct |
2 |
Incorrect |
276 ms |
8500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
274 ms |
8228 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |