# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
638908 |
2022-09-07T22:06:13 Z |
endy |
Mobile (BOI12_mobile) |
C++17 |
|
608 ms |
44184 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());
int t = dist[n-2].second.second, u = dist[n-1].second.second;
int ax = coord[t].first, ay = coord[t].second, bx = coord[u].first, by = coord[u].second;
int T = (ax*ax), U = (ay*ay), V = (bx*bx), W = (by*by);
int 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 |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
680 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 |
39 ms |
5244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
41 ms |
5192 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
5160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
5728 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
5608 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
231 ms |
21360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
307 ms |
21300 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
273 ms |
34556 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
372 ms |
34564 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
320 ms |
34560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
429 ms |
34476 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
34784 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
490 ms |
34456 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
434 ms |
40872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
608 ms |
44184 KB |
Expected double, but "-nan" found |
2 |
Halted |
0 ms |
0 KB |
- |