# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
547048 | 2022-04-09T09:46:53 Z | mgl_diamond | Balloons (CEOI11_bal) | C++14 | 675 ms | 5764 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define ii pair<int, int> #define dd pair<ld, ld> #define iii pair<int, ii> #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cout << "> " << #x << ": " << x << '\n' template<class T> bool maximize(T&a, T b) { if (a<b) return a=b, 1; return 0; } template<class T> bool minimize(T&a, T b) { if (a>b) return a=b, 1; return 0; } void setIO(string name="") { ios::sync_with_stdio(0); cin.tie(0); if (name.size()) freopen((name+".in").c_str(), "r", stdin); if (name.size()) freopen((name+".out").c_str(), "w", stdout); } int n; stack<dd> st; int main() { cin >> n; for(int i=0; i<n; ++i) { ld x, r; cin >> x >> r; while (st.size()) { ld x1=st.top().fi, r1=st.top().se; ld val=x1-x; minimize(r, (val*val)/(4*r1)); if (r>=r1) st.pop(); else break; } st.push({x, r}); cout << setprecision(4) << fixed << r << " "; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 212 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 212 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 64 ms | 412 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 180 ms | 1108 KB | 50000 numbers |
2 | Correct | 176 ms | 1616 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 310 ms | 1532 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 364 ms | 1672 KB | 115362 numbers |
2 | Correct | 379 ms | 3464 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 502 ms | 2040 KB | 154271 numbers |
2 | Correct | 639 ms | 5764 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 673 ms | 2136 KB | 200000 numbers |
2 | Correct | 675 ms | 5580 KB | 199945 numbers |