Submission #941300

#TimeUsernameProblemLanguageResultExecution timeMemory
941300KavelmydexMobile (BOI12_mobile)C++17
60 / 100
1010 ms26552 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define pi pair<int,int> #define vi vector<int> #define rep(i,x,n) for(int i=x; i<n; ++i) #define For(i,n) rep(i,0,n) #define pb push_back #define endl "\n" #define sp ' ' #define f first #define s second #define sz size() #define all(x) (x).begin(),(x).end() const int N = 3e5+10, OO = 1e18, mod = 1e9+7; void tr(int a, int b){cout << a << sp << b << endl;} void cmx(int &a, int b){a = max(a,b);} void cmn(int &a, int b){a = min(a,b);} vector <pi> v; int n,L; bool cmp(const pi &a, const pi &b){ return (a.f==b.f ? abs(a.s) < abs(b.s): a.f < b.f); } bool ok(double m){ double mn = OO, mx = -OO, z = 0; For(i,n){ auto [x,y] = v[i]; if(y*y > m*m) continue; double d = sqrt(m * m - y * y); if(x-d <= z){ z = max(z,x+d); } if(x-d < mn) mn = x-d; if(mx < x+d) mx = x+d; } return (mn <= 0 && L <= mx && z >= L); } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> L; For(i,n){ int x,y; cin >> x >> y; v.pb({x,y}); } sort(all(v),cmp); double l = 0, r = 1e10; For(i,100){ double m = (l+r)/2; bool b = ok(m); if(b) r = m; else l = m; } cout << setprecision(10) << r << endl; 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...