제출 #1166001

#제출 시각아이디문제언어결과실행 시간메모리
1166001aadisaini2012Mobile (BOI12_mobile)C++20
100 / 100
265 ms16092 KiB
#include <bits/stdc++.h> using namespace std; // Store positions of mobile towers pair<long long, long long> towers[1000000]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int numTowers, roadLength; cin >> numTowers >> roadLength; // Read tower positions (x, y) for (int i = 0; i < numTowers; i++) { cin >> towers[i].first >> towers[i].second; } // Binary search for minimum radius needed double left = 1, right = 1.5e9; while (right - left > 1e-3) { // Precision threshold double radius = (left + right) / 2; double coverage = 0; // Current coverage along the road for (int i = 0; i < numTowers; i++) { // Calculate horizontal coverage range using Pythagorean theorem double horizontalRange = sqrt(radius * radius - towers[i].second * towers[i].second); double startPoint = towers[i].first - horizontalRange; double endPoint = towers[i].first + horizontalRange; // If this tower overlaps with current coverage, extend the coverage if (startPoint <= coverage) { coverage = max(coverage, endPoint); } } // Check if we covered the entire road if (coverage >= roadLength) { right = radius; // Try smaller radius } else { left = radius; // Need larger radius } } cout << fixed << setprecision(4) << left; 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...