# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1116635 | 2024-11-22T02:59:00 Z | pemguimn | Balloons (CEOI11_bal) | C++17 | 3 ms | 508 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, x[N], r[N]; long double ans[N]; long double calc(int i, int j){ double x1 = x[i], y1 = ans[i]; double x2 = x[j]; return (x1 * x1 + x2 * x2 - 2.0L * x1 * x2 ) / (4.0L * y1); } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifndef Pemgu #define task "BALLOONS" freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); #endif // Pemgu cin >> n; for(int i = 1; i <= n; i++){ cin >> x[i] >> r[i]; ans[i] = r[i]; } stack<int> st; for(int i = 1; i <= n; i++){ long double reach = r[i]; while(st.size()){ reach = min(reach, calc(st.top(), i)); if(reach < ans[st.top()]) break; st.pop(); } ans[i] = reach; st.push(i); } for(int i = 1; i <= n; i++) cout << setprecision(9) << fixed << ans[i] << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 508 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 504 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Unexpected end of file - double expected |
2 | Halted | 0 ms | 0 KB | - |