Submission #1073881

#TimeUsernameProblemLanguageResultExecution timeMemory
1073881vjudge1Mobile (BOI12_mobile)C++17
0 / 100
1079 ms78624 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; ll L; cin >> n >> L; vector <pair<ll,ll>> pts; for(int i=0; i<n; i++){ ll x, y; cin >> x >> y; if(!pts.empty() && x == pts.back().first){ pts.back().second = min(pts.back().second, abs(y)); } else{ pts.push_back({x,abs(y)}); } } n = pts.size(); const ld EPS = 1e-8; ld l=0, r=1e10, mid; while(r-l>EPS){ mid = (l+r)/2; vector <pair<ld,ld>> seg; for(int i=0; i<n; i++){ ld x = pts[i].first, y = pts[i].second; if(mid <= y){ continue; } ld d = sqrt(mid*mid-y*y); seg.push_back({max((ld)0.0, x-d),min((ld)L, x+d)}); } sort(seg.begin(), seg.end()); vector <pair<ld,ld>> processed; for(auto [start,end] : seg){ if(!processed.empty() && start<=processed.back().second){ processed.back().second = max(processed.back().second, end); } else{ processed.push_back({start, end}); } } bool can = false; if(processed.size() == 1){ auto [x,y] = processed[0]; if(abs(x) < EPS && abs(y-L) < EPS){ can = true; } } if(can) r = mid; else l = mid; } cout << fixed << setprecision(6) << l << '\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...