Submission #493272

#TimeUsernameProblemLanguageResultExecution timeMemory
493272CraniXortMobile (BOI12_mobile)C++17
4 / 100
918 ms31552 KiB
#include <bits/stdc++.h> #define maxn 100005 long double delta = 0.000001; #define fin std::cin #define fout std::cout std::vector <std::pair <long double, long double>> v; bool check(long double lenght, long double l) { long double left = -123, right = -123; for(auto i: v) { if(l*l - i.second * i.second < 0) continue; long double r = sqrtl(l*l - i.second * i.second); if(left == -123 and right == -123) { right = i.first + r; left = i.first - r; continue; } if(right >= i.first - r) { right = std::max(right, i.first + r); left = std::min(left, i.first - r); } } if(left <= 0 and right >= lenght) return true; return false; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); int n; long double lenght; fin >> n >> lenght; v.resize(n); for(int i = 0; i < n; i ++) fin >> v[i].first >> v[i].second; long double left = 0, right = 2e9, mid, ans = 0; while(right - left >= delta) { mid = (left + right) / 2; if(check(lenght, mid) == true) { ans = mid; right = mid - delta; } else left = mid + delta; } fout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...