Submission #699451

#TimeUsernameProblemLanguageResultExecution timeMemory
699451vjudge1Balloons (CEOI11_bal)C++17
100 / 100
212 ms11776 KiB
#include <bits/stdc++.h> using namespace std; using lint = int64_t; using ld = long double; constexpr int _mod = int(1e9) + 7; constexpr int _inf = 0x3f3f3f3f; constexpr int _ninf = 0xcfcfcfcf; constexpr lint _linf = 0x3f3f3f3f3f3f3f3f; #define endl '\n' int n; vector<pair<ld,ld>> v; stack<pair<ld,ld>> st; ld solve(ld x, ld r) { while(!st.empty()) { auto [x1, r1] = st.top(); r = min(r, ((x1 - x) * (x1 - x)) / (4 * r1)); if(r1 > r) break; st.pop(); } st.push({x, r}); return r; } int main() { cin.tie(nullptr)->sync_with_stdio(false); cin >> n; v.resize(n); for(auto &i : v) { cin >> i.first >> i.second; }; for(int i = 0; i < n; i++) { cout << fixed << setprecision(3) << solve(v[i].first, v[i].second) << endl; } 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...