# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917151 | 2024-01-27T10:23:14 Z | FucKanh | Balloons (CEOI11_bal) | C++14 | 126 ms | 8588 KB |
#include<bits/stdc++.h> using namespace std; void IOfile(string name) { freopen((name + ".inp").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } pair<double,double> a[200005]; stack<int> st; double findr(pair<int, double> a, double bx) { return (a.first - bx) * (a.first - bx) / (4 * a.second); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // IOfile("TEST"); int n; cin >> n; for (int i =0 ; i <n;i++) { int x,r; cin >> x >> r; a[i] = {x,r}; } st.push(0); for (int i = 1; i < n; i++) { while (st.size()) { a[i].second=min(a[i].second, findr(a[st.top()], a[i].first)); if (a[st.top()].second <= a[i].second) { st.pop(); } else break; } st.push(i); } for (int i = 0; i < n; i++) cout << fixed << setprecision(3) << a[i].second << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 2908 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 3652 KB | 50000 numbers |
2 | Correct | 25 ms | 3928 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 4992 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 5424 KB | 115362 numbers |
2 | Correct | 60 ms | 5548 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 89 ms | 6484 KB | 154271 numbers |
2 | Correct | 97 ms | 8588 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 126 ms | 7912 KB | 200000 numbers |
2 | Correct | 111 ms | 8540 KB | 199945 numbers |