Submission #151750

#TimeUsernameProblemLanguageResultExecution timeMemory
151750forestryksBalloons (CEOI11_bal)C++14
100 / 100
329 ms16636 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; #define rep(i, n) for (int (i) = 0; (i) < (n); ++(i)) #define all(x) (x).begin(), (x).end() #define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define f first #define s second const int MAXN = 2e5 + 5; int n; pair<ld, ld> a[MAXN]; ld get(ld x1, ld r1, ld x) { return (x1 - x) * (x1 - x) / 4 / r1; } int main() { FAST_IO; cout.precision(10); cout.setf(ios::fixed); cin >> n; rep(i, n) { cin >> a[i].f >> a[i].s; } vector<pair<ld, ld>> st; rep(i, n) { while (!st.empty()) { a[i].s = min(a[i].s, get(st.back().f, st.back().s, a[i].f)); if (a[i].s > st.back().s) st.pop_back(); else break; } st.push_back(a[i]); cout << a[i].s << '\n'; } }
#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...