# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
485105 | 2021-11-06T07:51:49 Z | largefence | Balloons (CEOI11_bal) | C++17 | 144 ms | 6448 KB |
#include <bits/stdc++.h> using namespace std; #define pw2(x) ((x)*(x)) double x[200000], r[200000], pck[200000]; int main() { //ios::sync_with_stdio(false); //cin.tie(0); //freopen("ws.INP", "r", stdin); //freopen("ws.OUT", "w", stdout); int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%lf %lf", &x[i], &r[i]);//cin >> x[i] >> r[i]; pck[0] = r[0]; printf("%.3lf\n", pck[0]); stack<int> st; st.push(0); for (int i = 1; i < n; i++) { pck[i] = r[i]; /* if distance between 2 center < sum of rad of circles => intersect ^ <=> sqrt((x[i] - x[j])^2 + (h[i] - h[j])^2) == h[i] + h[j] => maximal */ while (!st.empty()) { int j = st.top(); double res = pw2(x[i] - x[j]) / (4.0 * pck[j]); pck[i] = min(pck[i], min(r[i], res)); if (pck[i] >= pck[j]) st.pop(); else break; } st.push(i); printf("%.3lf\n", pck[i]); } return 0; } // How to AC ?
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 932 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 1880 KB | 50000 numbers |
2 | Correct | 33 ms | 1724 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 3432 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 81 ms | 4016 KB | 115362 numbers |
2 | Correct | 78 ms | 3800 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 106 ms | 5228 KB | 154271 numbers |
2 | Correct | 114 ms | 6096 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 144 ms | 6448 KB | 200000 numbers |
2 | Correct | 116 ms | 6164 KB | 199945 numbers |