Submission #949678

#TimeUsernameProblemLanguageResultExecution timeMemory
949678KavelmydexMobile (BOI12_mobile)C++17
0 / 100
1099 ms25780 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #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 endl "\n" #define sp ' ' #define pb push_back #define f first #define s second #define sz size() #define all(x) (x).begin(),(x).end() const int N = 4e5+10, OO = 1e18, mod = 1e9, mx = 2e6; void tr(int a, int b){cout << a << sp << b << endl;} void cmx(double &a, double b){a = max(a,b);} void cmn(double &a, double b){a = min(a,b);} int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int n,l; cin >> n >> l; vector <pi> v; For(i,n){ int x,y; cin >> x >> y; y = abs(y); v.pb({x,y}); } double ans = 0, mn = OO, mn2 = OO; For(i,n){ cmn(mn, sqrt(v[i].f*v[i].f + v[i].s*v[i].s)); int x = abs(v[i].f-l); cmn(mn2, sqrt(x * x + v[i].s * v[i].s)); } cmx(ans, max(mn2,mn)); vector <pi> u,q; For(i,n){ bool ok = 0; for(auto [x,y]: u){ int X = abs(x-v[i].f); if(X * X + y * y <= v[i].s * v[i].s){ ok = 1; } } if(ok){ u.pb(v[i]); } else { u.clear(); u.pb(v[i]); if( i ){ double cost = OO; pi p; for(auto [x,y]: q){ double X = abs(x-v[i].f); double d = ( X*X + v[i].s * v[i].s - y * y ) / ( 2*X ), val = sqrt(d * d + y * y); if(val < cost){ cost = val; p = {x,y}; } } q.clear(); if(p.f < 0 && v[i].f < 0); else cmx(ans, cost); } } q.pb(v[i]); } cout << fixed << setprecision(4) << ans << 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...