Submission #919095

#TimeUsernameProblemLanguageResultExecution timeMemory
919095Em1LBalloons (CEOI11_bal)C++14
100 / 100
112 ms5576 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, double>; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout << setprecision(3) << fixed; int n; cin >> n; stack < pii > st; auto GetR = [&](pii A, ll x) { auto [x_, r_] = A; return (x_ - x) * (x_ - x) / (4 * r_); }; for (int i = 0, x, r; i < n; i++) { cin >> x >> r; double R = r; while (!st.empty()) { double curR = GetR(st.top(), x); R = min(R, curR); if (R >= st.top().second) { st.pop(); } else { break; } } cout << R << "\n"; st.push(make_pair(x, R)); } }

Compilation message (stderr)

bal.cpp: In lambda function:
bal.cpp:16:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |         auto [x_, r_] = A;
      |              ^
#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...