Submission #459571

#TimeUsernameProblemLanguageResultExecution timeMemory
459571BackNoobMobile (BOI12_mobile)C++14
50 / 100
1098 ms8104 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define endl '\n' #define mask(i) (1LL << (i)) #define task "name" #define ld long double #define ull unsigned long long using namespace std; const ll mxN = 1e6 + 7; const ll inf = 1e9 + 277; const ll mod = 2147483648; const ll infll = 1e18 + 7; const ll base = 307; template <typename T1, typename T2> bool minimize(T1 &a, T2 b) { if (a > b) {a = b; return true;} return false; } template <typename T1, typename T2> bool maximize(T1 &a, T2 b) { if (a < b) {a = b; return true;} return false; } struct Point{ int x , y; } a[mxN]; int n , L; bool ok(ld x) { ld minl = 0; vector<pair<ld , ld>> seg; for(int i = 1 ; i <= n ; i++) { ld h = abs(a[i].y); if(h > x) continue; if(h == x) seg.push_back({a[i].x , a[i].x}); if(h < x) { ld leng = sqrt(x * x - h * h); ld l = a[i].x - leng; ld r = a[i].x + leng; if(l <= minl) minl = max(minl , r); } } return minl >= L; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("task.inp" , "r" , stdin); // freopen("task.out" , "w" , stdout); cin >> n >> L; for(int i = 1 ; i <= n ; i++) cin >> a[i].x >> a[i].y; ld l = 0 , r = 1.5e9; for(int i = 1 ; i <= 100 ; i++) { ld mid = (l + r) / 2; if(ok(mid)) r = mid; else l = mid; } cout << fixed << setprecision(6) << l; 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...