Submission #482388

#TimeUsernameProblemLanguageResultExecution timeMemory
482388chungdinhBalloons (CEOI11_bal)C++17
100 / 100
565 ms11204 KiB
#include <cstdio> #include <vector> #include <queue> #include <map> #include <stack> #include <set> #include <algorithm> #include <iostream> #include <cstring> using namespace std; #define ll long long #define ii pair<int, int> #define FOR(i, l, r) for (int i = (l); i <= (r); i++) #define all(x) x.begin(), x.end() const int N = 5e5 + 5; const ll MOD = 998244353; int n; pair<long double, long double> a[N]; long double z[N]; int main() { #ifdef CHUNGDINH freopen("main.inp","r",stdin); #endif // CHUNGDINH stack<int> st; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].first >> a[i].second; long double &r = z[i]; r = a[i].second; while (st.size()) { int u = st.top(); r = min(r, (a[i].first - a[u].first) * (a[i].first - a[u].first) / 4 / z[u]); if (r >= z[u]) st.pop(); else break; } st.push(i); printf("%.3Lf\n", r); } }
#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...