Submission #1026864

#TimeUsernameProblemLanguageResultExecution timeMemory
1026864peyman_sfMobile (BOI12_mobile)C++17
0 / 100
1092 ms10836 KiB
#include <iostream> #include <fstream> #include <iomanip> #include <stack> #include <cmath> #include <cstring> #include <algorithm> #include <vector> #include <string> #include <map> #include <set> #include <deque> #include <queue> #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); #define fileTesting ifstream fileIn("input.txt"); cin.rdbuf(fileIn.rdbuf()); ofstream fileOut("output.txt"); cout.rdbuf(fileOut.rdbuf()); #define endl '\n' #define print(x) for (auto i : x) cout << i << ' '; cout << endl #define nloop(a, n) for (ll i = a; i < n; i++) #define debug(x) cerr << #x << " is " << x << endl #define all(x) (x).begin(), (x).end() #define pb push_back #define ff first #define ss second using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vll; typedef vector<ld> vld; typedef pair<int, int> pii; typedef pair<ld, ld> pld; const ll maxN = 1e9; const ll mod = 1e9 + 7; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b);} ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } ld n, len; vector<pii> points; ld check(ld r) { ld cl = 0, cr = 0; for (auto &p : points) { ld d = sqrt(pow(r, 2) - pow(p.second, 2)); if (p.first - d > cr) return 0; else { cl = min(cl, p.first - d); cr = max(cr, p.first + d); } } if (cl <= 0 && cr >= len) return 1; return 0; } void solution() { cin >> n >> len; for (ll i = 0; i < n; i++) { ll x, y; cin >> x >> y; points.push_back(make_pair(x, y)); } ld l = 0, r = len + 1, m; for (ll i = 0; i < 200; i++) { m = (l + r) / 2; if (check(m)) r = m; else l = m; } cout << fixed << setprecision(6) << r << endl; } int main() { FastIO ll t = 1; // cin >> t; while (t--) { solution(); } 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...