Submission #746304

#TimeUsernameProblemLanguageResultExecution timeMemory
746304kr_2003Balloons (CEOI11_bal)C++14
100 / 100
485 ms14740 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double double sq(double a) { return a * a; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // #ifndef ONLINE_JUDGE // freopen("cowland.in", "r", stdin); // freopen("cowland.out", "w", stdout); // #endif int n; cin >> n; double x[n], r[n]; double r_f[n]; for (int i = 0; i < n; ++i) { cin >> x[i]; cin >> r[i]; } stack<int>st; for (int i = 0; i < n; ++i) { // if (st.size()) cout << st.top() << endl; while (st.size()) { double rad = sq(x[i] - x[st.top()]) / (4 * r_f[st.top()]); r[i] = min(r[i], rad); // cout << r[i] << endl; if (r[i] >= r_f[st.top()]) { st.pop(); continue; } else break; } r_f[i] = r[i]; st.push(i); } cout << fixed << setprecision(3); for (int i = 0; i < n; ++i) { cout << r_f[i] << 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...