# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1079717 |
2024-08-28T22:53:55 Z |
EmmaXII |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
64656 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
#define all(x) x.begin(), x.end()
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(NULL);
int N;
ll L;
cin >> N >> L;
vector<ll> X(N);
vector<ll> Y(N);
for (int i=0;i<N;i++) cin >> X[i] >> Y[i];
auto get_hw = [&](ll y, double r) {
if (abs(y) > r) return -1.0;
return sqrt((r-y) * (r+y));
};
auto can_do = [&](double R) {
vector<pair<double, double>> ivals;
for (int i=0;i<N;i++) {
double hw = get_hw(Y[i], R);
if (hw < 0) continue;
ivals.push_back({(double)X[i] - hw, (double)X[i] + hw});
}
sort(all(ivals));
double progress = 0.;
for (auto [l, r] : ivals) {
if (l > progress + 1e-5) return false;
progress = max(progress, r);
}
return progress >= (double)L;
};
double lo = 0;
ll lhi = L + abs(X[0]) + abs(Y[0]);
lhi = lhi*lhi;
for (int i=0;i<N;i++) {
ll nhi = max(
X[i]*X[i] + Y[i]*Y[i],
(X[i]-L)*(X[i]-L) + Y[i]*Y[i]
);
lhi = min(nhi, lhi);
}
double hi = sqrt(lhi);
while (hi - lo > 5e-4) {
double mid = (lo + hi) / 2;
if (can_do(mid)) hi = mid;
else lo = mid;
}
cout << setprecision(10);
cout << lo << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
584 KB |
Output is correct |
2 |
Correct |
6 ms |
812 KB |
Output is correct |
3 |
Correct |
6 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
10 ms |
808 KB |
Output is correct |
3 |
Correct |
6 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
796 KB |
Output is correct |
2 |
Correct |
5 ms |
812 KB |
Output is correct |
3 |
Correct |
7 ms |
704 KB |
Output is correct |
4 |
Correct |
2 ms |
616 KB |
Output is correct |
5 |
Correct |
1 ms |
552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
5676 KB |
Output is correct |
2 |
Correct |
171 ms |
6008 KB |
Output is correct |
3 |
Correct |
99 ms |
3560 KB |
Output is correct |
4 |
Correct |
18 ms |
3436 KB |
Output is correct |
5 |
Correct |
8 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
3036 KB |
Output is correct |
2 |
Correct |
14 ms |
2784 KB |
Output is correct |
3 |
Correct |
17 ms |
3296 KB |
Output is correct |
4 |
Correct |
21 ms |
3552 KB |
Output is correct |
5 |
Correct |
22 ms |
3948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
5996 KB |
Output is correct |
2 |
Correct |
188 ms |
6288 KB |
Output is correct |
3 |
Correct |
208 ms |
4768 KB |
Output is correct |
4 |
Incorrect |
26 ms |
4448 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
201 ms |
7224 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
7216 KB |
Output is correct |
2 |
Correct |
239 ms |
7076 KB |
Output is correct |
3 |
Correct |
242 ms |
6272 KB |
Output is correct |
4 |
Incorrect |
26 ms |
4588 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
744 ms |
28628 KB |
Output is correct |
2 |
Execution timed out |
1070 ms |
32048 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1024 ms |
32540 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1048 ms |
40896 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1093 ms |
45544 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
44900 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1012 ms |
50496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1031 ms |
49008 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
55148 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1024 ms |
57104 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1032 ms |
64656 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |