# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
521934 |
2022-02-03T13:23:56 Z |
sofapuden |
Mobile (BOI12_mobile) |
C++14 |
|
801 ms |
16324 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
double k;
int n; cin >> n >> k;
vector<pair<double,double>> v(n);
for(auto &x : v)cin >> x.first >> x.second;
double l = 0, r = 2e9;
while((r-l) > 0.001){
double mid = (l+r)/2.0;
vector<double> ran1, ran2;
for(int i = 0; i < n; ++i){
if(abs(v[i].second) >= mid)continue;
double z = sqrt(mid*mid-v[i].second*v[i].second);
while(ran1.size() && max(v[i].first-z,0.0) < ran1.back()){
ran1.pop_back();
ran2.pop_back();
}
if(ran1.empty() || v[i].first+z > ran2.back()){
if(ran1.size() && v[i].first-z < ran2.back()){
ran1.back() = max(0.0,min(v[i].first-z,ran1.back()));
ran2.back() = min(v[i].first+z,k);
}
else{
ran1.push_back(max(min(v[i].first-z,k),0.0));
ran2.push_back(min(max(v[i].first+z,0.0),k));
}
}
if(ran1.back() == ran2.back()){
ran1.pop_back();
ran2.pop_back();
}
}
if(ran1.empty() || ran1[0] != 0 || ran2.back() != k){
l = mid;
continue;
}
bool ok = 1;
for(int i = 1; i < (int)ran1.size(); ++i){
if(ran2[i-1] < ran1[i]){
ok = 0;
break;
}
if(ran2[i] == k)break;
}
if(ok){
r = mid;
}
else{
l = mid;
}
}
printf("%.3f\n", l);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 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 |
2 ms |
372 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
332 KB |
Output is correct |
2 |
Correct |
4 ms |
452 KB |
Output is correct |
3 |
Correct |
3 ms |
324 KB |
Output is correct |
4 |
Correct |
4 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
332 KB |
Output is correct |
4 |
Correct |
5 ms |
468 KB |
Output is correct |
5 |
Correct |
4 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
1864 KB |
Output is correct |
2 |
Correct |
57 ms |
1884 KB |
Output is correct |
3 |
Correct |
36 ms |
1444 KB |
Output is correct |
4 |
Correct |
46 ms |
1868 KB |
Output is correct |
5 |
Correct |
39 ms |
1356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
1824 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
2072 KB |
Output is correct |
2 |
Correct |
60 ms |
1932 KB |
Output is correct |
3 |
Correct |
56 ms |
2020 KB |
Output is correct |
4 |
Correct |
64 ms |
2244 KB |
Output is correct |
5 |
Correct |
52 ms |
2080 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
2196 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
2252 KB |
Output is correct |
2 |
Correct |
75 ms |
2260 KB |
Output is correct |
3 |
Incorrect |
68 ms |
2256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
363 ms |
8524 KB |
Output is correct |
2 |
Correct |
380 ms |
8624 KB |
Output is correct |
3 |
Correct |
417 ms |
8516 KB |
Output is correct |
4 |
Incorrect |
315 ms |
8524 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
429 ms |
8524 KB |
Output is correct |
2 |
Correct |
394 ms |
8524 KB |
Output is correct |
3 |
Correct |
340 ms |
8520 KB |
Output is correct |
4 |
Correct |
306 ms |
8644 KB |
Output is correct |
5 |
Correct |
315 ms |
8640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
387 ms |
10080 KB |
Output is correct |
2 |
Correct |
532 ms |
10084 KB |
Output is correct |
3 |
Correct |
437 ms |
10060 KB |
Output is correct |
4 |
Correct |
415 ms |
10180 KB |
Output is correct |
5 |
Correct |
344 ms |
10084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
481 ms |
10084 KB |
Output is correct |
2 |
Correct |
477 ms |
10084 KB |
Output is correct |
3 |
Correct |
384 ms |
10080 KB |
Output is correct |
4 |
Correct |
381 ms |
10084 KB |
Output is correct |
5 |
Correct |
383 ms |
10080 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
482 ms |
11644 KB |
Output is correct |
2 |
Correct |
526 ms |
11648 KB |
Output is correct |
3 |
Correct |
515 ms |
11648 KB |
Output is correct |
4 |
Incorrect |
472 ms |
11644 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
630 ms |
11648 KB |
Output is correct |
2 |
Incorrect |
563 ms |
11688 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
545 ms |
13216 KB |
Output is correct |
2 |
Incorrect |
618 ms |
13212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
660 ms |
13212 KB |
Output is correct |
2 |
Correct |
623 ms |
13208 KB |
Output is correct |
3 |
Correct |
536 ms |
13088 KB |
Output is correct |
4 |
Correct |
512 ms |
13004 KB |
Output is correct |
5 |
Correct |
484 ms |
13092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
675 ms |
16324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
801 ms |
15968 KB |
Output is correct |
2 |
Correct |
745 ms |
16212 KB |
Output is correct |
3 |
Correct |
653 ms |
16216 KB |
Output is correct |
4 |
Correct |
651 ms |
15968 KB |
Output is correct |
5 |
Correct |
646 ms |
16100 KB |
Output is correct |