Submission #838825

#TimeUsernameProblemLanguageResultExecution timeMemory
838825a5a7Mobile (BOI12_mobile)C++14
0 / 100
1078 ms62852 KiB
#include <bits/stdc++.h> #define ALL(x) (x).begin(), (x).end() #define REP(i, a, b) for (int i = (a); i < (b); i++) #define READ(arr, n) for (int i = 0; i < (n); i++) cin >> arr[i]; #define ABS(a) (max((a), -(a))) #define MOD 1000000007 using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; long double l; cin >> n >> l; long double x[n]; long double y[n]; for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; long double left = 0; long double right = l; while ((right-left) > (0.000001)){ long double mid = (left+right)/2; bool coversAll = true; pair<long double, long double> ranges[n]; for (int i = 0; i < n; i++){ long double sqr = sqrt(max(mid*mid-y[i]*y[i], (long double) 0)); ranges[i].first = x[i]-sqr; ranges[i].second = x[i]+sqr; } sort(ranges, ranges+n); if (ranges[0].first > 0) coversAll = false; if (ranges[n-1].second < l) coversAll = false; for (int i = 0; i < (n-1) && coversAll; i++){ if (ranges[i].second < ranges[i+1].first) coversAll = false; } if (coversAll){ right = mid; }else{ left = mid; } } cout << left << endl; }
#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...