Submission #1101199

#TimeUsernameProblemLanguageResultExecution timeMemory
1101199zyadhanyMobile (BOI12_mobile)C++17
100 / 100
648 ms16120 KiB
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> #define ll long long #define ld long double #define pl pair<ll, ll> #define vi vector<ll> #define vii vector<vi> #define vc vector<char> #define vcc vector<vc> #define vp vector<pl> #define mi map<ll,ll> #define mc map<char,ll> #define sortx(X) sort(X.begin(),X.end()); #define all(X) X.begin(),X.end() #define ln '\n' #define YES {cout << "YES\n"; return;} #define NO {cout << "NO\n"; return;} #define MUN {cout << "-1\n"; return;} const int MODE = 1e9 + 7; using namespace std; void solve(int tc) { ll n, len; cin >> n >> len; vp X(n); for (int i = 0; i < n; i++) cin >> X[i].first >> X[i].second; ld l = 0, r = 1e12; ld err = 1e-6; while (r - l > err) { double mid = (l + r) / 2, curr = 0; for (int i = 0; i < n; i++) { double delta = sqrt(mid * mid - X[i].second * X[i].second); double a = X[i].first - delta, b = X[i].first + delta; if (a <= curr) curr = max(curr, b); } if (curr >= len) r = mid; else l = mid; } cout << fixed << setprecision(6) << l << '\n'; } int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); int size = 1; //freopen("loan.in", "r", stdin); //freopen("loan.out", "w", stdout); //cin >> size; for (int i = 1; i <= size; i++) solve(i); }
#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...