# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
115197 |
2019-06-06T01:08:56 Z |
luciocf |
Mobile (BOI12_mobile) |
C++14 |
|
1000 ms |
772 KB |
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
const int maxn = 5e3+10;
const double inf = 1e9+10;
typedef pair<double, double> pt;
int n;
double L;
pt p[maxn];
double dist(pt a, pt b)
{
double d1 = a.ff-b.ff;
double d2 = a.ss-b.ss;
return sqrt(d1*d1 + d2*d2);
}
bool ok(double K)
{
vector<double> V;
for (int i = 1; i <= n; i++)
{
double x = p[i].ff, y = p[i].ss;
double delta = sqrt(K*K - y*y);
double x1 = x+delta, x2 = x-delta;
x1 = min(x1, L); x1 = max(x1, 0.00);
x2 = min(x2, L); x2 = max(x2, 0.00);
V.push_back(x1), V.push_back(x2);
}
double ans = 0.00;
for (auto x: V)
{
double aux = inf;
for (int i = 1; i <= n; i++)
aux = min(aux, dist({x, 0.00}, p[i]));
ans = max(ans, aux);
}
return (ans >= K);
}
double busca(void)
{
double ini = 0.00, fim = inf, ans = 0.00;
for (int i = 1; i <= 60; i++)
{
double mid = (ini+fim)/2.00;
if (ok(mid)) ans = mid, ini = mid;
else fim = mid;
}
return ans;
}
int main(void)
{
scanf("%d %lf\n", &n, &L);
for (int i = 1; i <= n; i++)
scanf("%lf %lf", &p[i].ff, &p[i].ss);
double d1 = inf, d2 = inf;
for (int i = 1; i <= n; i++)
{
d1 = min(d1, dist({0.00, 0.00}, p[i]));
d2 = min(d2, dist({L, 0.00}, p[i]));
}
printf("%.9lf\n", max({d1, d2, busca()}));
}
Compilation message
mobile.cpp: In function 'int main()':
mobile.cpp:76:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %lf\n", &n, &L);
~~~~~^~~~~~~~~~~~~~~~~~~~
mobile.cpp:79:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lf %lf", &p[i].ff, &p[i].ss);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
252 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
772 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
744 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |