Submission #1131355

#TimeUsernameProblemLanguageResultExecution timeMemory
1131355dhruv05Mobile (BOI12_mobile)C++20
0 / 100
1100 ms107896 KiB
#include <bits/stdc++.h> using namespace std; long long int N; long double L; vector<pair<long double, long double>> poles; bool check(int distancee3){ long double distance = ((long double) distancee3)/1000; map<long double, long long int> relevant_points; for (pair<long double, long double> pole: poles){ if (pole.second > distance){ return true; } long double r = sqrt(pow(distance, 2) - pow(pole.second, 2)); long double left = pole.first - r; long double right = pole.first + r; if (left < 0){ left = 0; } if (right < 0){ right = 0; } if (left < L){ if (relevant_points.find(left) != relevant_points.end()){ relevant_points[left]++; } else { relevant_points[left] = 1; } } if (right < L){ if (relevant_points.find(right) != relevant_points.end()){ relevant_points[right]--; } else { relevant_points[right] = -1; } } } long long int intervals_on = 0; if ((*relevant_points.begin()).first != 0){ return true; } for (auto point: relevant_points){ intervals_on += point.second; if (intervals_on <= 0){ return true; } } return false; } long long int binary_search_max(long long int high, long long int low){ while (low < high){ long long int mid = low + (high - low + 1)/2; if(check(mid)){ low = mid; } else{ high = mid - 1; } } return low; } int main(){ cin >> N >> L; long long int mind = LLONG_MAX; for (long long int i = 0; i < N; i++ ){ long double x, y; cin >> x >> y; poles.push_back({x, y}); mind = min(mind, (long long int) (max(sqrt(pow(y, 2) + pow(L - x, 2)), sqrt(pow(y, 2) + pow(x, 2)))*1000)); } cout << ((long double) binary_search_max(mind, 0))/1000 << 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...