Submission #906058

#TimeUsernameProblemLanguageResultExecution timeMemory
906058LudisseyMobile (BOI12_mobile)C++14
0 / 100
1076 ms90524 KiB
#include <bits/stdc++.h> using namespace std; #define int double 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<double,double>> a(N); map<int,int> minabs; for (int i = 0; i < N; i++){ cin >> a[i].first >> a[i].second; if(minabs.find(a[i].first)==minabs.end()) { minabs[a[i].first]=abs(a[i].second); } else { minabs[a[i].first]=min(minabs[a[i].first],abs(a[i].second)); } } double toL=1e10+100; double toO=1e10+100; double mxDst=0; for (int i = 0; i < N; i++) { toO=min(dist(0,0,a[i].first,minabs[a[i].first]),toO); toL=min(dist(L,0,a[i].first,minabs[a[i].first]),toL); } mxDst=max(toO,toL); for (int i = 0; i < N-1; i++) { double x1=a[i].first,y1=minabs[a[i].first],x2=a[i+1].first,y2=minabs[a[i+1].first]; if(x1==x2) continue; else{ double x=(((pow(x2,2)+pow(y2,2))-pow(x1,2))-pow(y1,2))/((((double)2*x1)-(double)2*x2)); if(x>L||x<0) continue; mxDst=max(min(dist(x2,y2,x,0),dist(x1,y1,x,0)),mxDst); } } cout << setprecision(4) << fixed << (double)mxDst << "\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...