Submission #493276

#TimeUsernameProblemLanguageResultExecution timeMemory
493276CraniXortMobile (BOI12_mobile)C++17
8 / 100
811 ms31692 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 = 0, right = 0; for(auto i: v) { if(l*l - i.second * i.second < 0) continue; long double r = sqrtl(l*l - i.second * i.second); if(i.first - r <= right) right = std::max(right, i.first + r); } if(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; } else left = mid; } fout << ans << '\n'; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'bool check(long double, long double)':
mobile.cpp:13:17: warning: unused variable 'left' [-Wunused-variable]
   13 |     long double left = 0, right = 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...