# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
638910 |
2022-09-07T22:09:13 Z |
endy |
Mobile (BOI12_mobile) |
C++17 |
|
597 ms |
39592 KB |
#include <bits/stdc++.h>
using namespace std;
int n, l, d;
vector < pair<double,double> > coord;
vector < pair<double, pair<double, int> > > dist;
int main(){
ios::sync_with_stdio(false); cin.tie(0);
cin >> n >> l;
for(int i=0 ; i<n ; i++){
double a, b;
cin >> a >> b;
coord.push_back(make_pair(a,b));
double dmin, dmax;
if(a < 0){
dmin = (a*a)+(b*b);
dmax = ((a+l)*(a+l))+(b*b);
}else if(a >= 0 and a <=l){
dmin = b;
if(a <= l/2) dmax = ((l-a)*(l-a))+(b*b);
else dmax = (a*a)+(b*b);
}else if(a > l){
dmin = ((a-l)*(a-l))+(b*b);
dmax = (a*a)+(b*b);
}
dist.push_back(make_pair(dmin, make_pair(dmax, i)));
}
sort(dist.begin(), dist.end());
double t = dist[n-2].second.second, u = dist[n-1].second.second;
double ax = coord[t].first, ay = coord[t].second, bx = coord[u].first, by = coord[u].second;
double T = (ax*ax), U = (ay*ay), V = (bx*bx), W = (by*by);
double centro = (U+V-W-T)/(2*(bx-ax));
if(centro > bx){
d = (by*by)+((centro-bx)*(centro-bx));
}else{
d = (by*by)+((bx-centro)*(bx-centro));
}
cout << sqrt(d) << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
724 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
724 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
724 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
4536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
4552 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
4528 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
4524 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
4564 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
224 ms |
19972 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
305 ms |
20020 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
265 ms |
33300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
365 ms |
33268 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
309 ms |
33280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
420 ms |
33304 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
352 ms |
33228 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
477 ms |
33224 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
423 ms |
39496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
597 ms |
39592 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |