Submission #1035041

#TimeUsernameProblemLanguageResultExecution timeMemory
1035041Uniq0rnMobile (BOI12_mobile)C++14
0 / 100
409 ms32604 KiB
#include <bits/stdc++.h> using namespace std; #define ld long double #define ll long long int #define pi pair<int,int> #define sz(x) (int)x.size() #define all(x) begin(x),end(x) int main() { cin.tie(0)->sync_with_stdio(0); int n; double L; cin >> n >> L; vector<pair<double,double>> a(n); for(auto &[x,y]:a) cin >> x >> y; sort(all(a)); auto len = [&](double a,double b){ return sqrt(a*a - b*b); }; double l = 0,r = 1e9; while(r - l > 0.0001){ double mid = (l + r) / 2.0; double mn = a[0].first - len(mid,a[0].second),mx = a[0].first + len(mid,a[0].second); bool ch = (mid >= a[0].second); for(int i=1;i<n && ch;i++){ if(mid < a[0].second){ ch = false; break; } double le = a[i].first - len(mid,a[i].second),ri = a[i].first + len(mid,a[i].second); if(le <= mx){ mx = ri; } else{ ch = false; break; } } if(ch && mn <= 0 && mx >= L){ r = mid; } else{ l = mid; } } cout << setprecision(6) << fixed << r; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:17:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   17 |     for(auto &[x,y]:a) cin >> x >> y;
      |               ^
#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...