Submission #465867

#TimeUsernameProblemLanguageResultExecution timeMemory
465867joshualiu555Mobile (BOI12_mobile)C++14
0 / 100
1095 ms48140 KiB
/* _____ _ _ / ____| | | | | | | __ _ __ __ _ ___ ___ _ _ _ __ ___ | |_ __ _| |_ ___ | | |_ | '__/ _` / __/ __| | | | '_ \ / _ \| __/ _` | __/ _ \ | |__| | | | (_| \__ \__ \ |_| | |_) | (_) | || (_| | || (_) | \_____|_| \__,_|___/___/\__, | .__/ \___/ \__\__,_|\__\___/ __/ | | |___/|_| */ #include <fstream> #include <iostream> #include <iomanip> #include <algorithm> #include <numeric> #include <array> #include <vector> #include <set> #include <map> #include <stack> #include <queue> #include <cmath> #include <cstring> #include <bitset> #include <string> #include <sstream> using namespace std; using ll = long long; const int INF = 1e6 + 5; const int MOD = 1e9 + 7; const int dx[4] = {1, -1, 0, 0}; const int dy[4] = {0, 0, 1, -1}; int N, L; pair<double, double> xy[INF]; bool check (double radius) { vector<pair<double, double>> segments; for (int i = 0; i < N; i++) { double left = xy[i].first - sqrt(pow(radius, 2) - pow(xy[i].second, 2)); double right = xy[i].first + sqrt(pow(radius, 2) - pow(xy[i].second, 2)); segments.push_back(make_pair(left, right)); } sort(segments.begin(), segments.end()); double search = 0; for (int i = 0; i < N; i++) { if (segments[i].first <= search + 1e-4 && search <= segments[i].second - 1e-4) { search = segments[i].second; } } return search >= L; } int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); // ifstream cin(".in"); // ofstream cout(".out"); cin >> N >> L; for (int i = 0; i < N; i++) { cin >> xy[i].first >> xy[i].second; } double l = 0, r = 1.5 * 1e9; for (int i = 0; i < 100; i++) { double m = (l + r) / 2; if (check(m)) { r = m; } else { l = m; } } cout << fixed << setprecision(6) << l << '\n'; return 0; } /* * */ //2 10 //0 0 //11 1
#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...