Submission #906167

#TimeUsernameProblemLanguageResultExecution timeMemory
906167LudisseyMobile (BOI12_mobile)C++14
100 / 100
409 ms10628 KiB
#include <bits/stdc++.h> using namespace std; double dist(double x1, double y1, double x2, double y2){ double dist=sqrt(pow((x1-x2),2)+pow((y1-y2),2)); return dist; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N,L; cin >> N >> L; vector<pair<int,int>> a; for (int i = 0; i < N; i++){ int x,y; cin >> x >> y; y=abs(y); if(i>0&&a[a.size()-1].first==x) a[a.size()-1].second=min(a[a.size()-1].second,y); else{ a.push_back({x,y}); } } N=a.size(); double l=0,r=1e9; while(r-l>0.0009){ double mid=(l+r)/2; double rght=0; for (int i = 0; i < a.size(); i++) { if(mid<(double)a[i].second) continue; double pnt1=a[i].first-sqrt((mid*mid)-((double)a[i].second*(double)a[i].second)),pnt2=(double)a[i].first+sqrt((mid*mid)-((double)a[i].second*(double)a[i].second)); if(pnt1<=rght) rght=max(rght, pnt2); } if(rght>=L) { r=mid; }else{ l=mid; } } cout << setprecision(3) << fixed << l << "\n"; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for (int i = 0; i < a.size(); i++)
      |                         ~~^~~~~~~~~~
#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...