Submission #956897

# Submission time Handle Problem Language Result Execution time Memory
956897 2024-04-02T15:59:42 Z dzzz Balloons (CEOI11_bal) C++17
10 / 100
154 ms 19320 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 2e5 + 10;
struct ball {
    long double x, r;
};
int n;
ball a[maxn];
long double ra[maxn];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i].x >> a[i].r;
        ra[i] = a[i].r;
    }
    deque <ball> d;
    for(int i = 1; i <= n; ++i) {
        while(!d.empty()) {
            ball tmp = d.back();
            //ra[i] = min(ra[i], (a[i].x - tmp.x)*(a[i].x - tmp.x) / (4.0*tmp.r));
            if(ra[i] > (a[i].x - tmp.x)*(a[i].x - tmp.x) / (4.0*tmp.r)) {
                ra[i] = (a[i].x - tmp.x)*(a[i].x - tmp.x) / (4.0*tmp.r);
            }
            if(ra[i] >= tmp.r) d.pop_back();
            else break;
        }
        d.push_back(a[i]);
    }
    for(int i = 1; i <= n; ++i) {
        cout << fixed << setprecision(3) << ra[i] << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB 5th numbers differ - expected: '17.1630000000', found: '4.3710000000', error = '12.7920000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2392 KB 3rd numbers differ - expected: '0.0420000000', found: '2.0830000000', error = '2.0410000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2652 KB 3rd numbers differ - expected: '121.0000000000', found: '120.0180000000', error = '0.9820000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 5732 KB 3rd numbers differ - expected: '211.0000000000', found: '210.0110000000', error = '0.9890000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 8768 KB 3rd numbers differ - expected: '15396.0000000000', found: '9489.3930000000', error = '5906.6070000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 86 ms 11740 KB 3rd numbers differ - expected: '7936.0000000000', found: '6084.6240000000', error = '1851.3760000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 14588 KB 6th numbers differ - expected: '5053.0000000000', found: '5052.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 129 ms 16816 KB 3rd numbers differ - expected: '1872.0000000000', found: '1871.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 19320 KB 3rd numbers differ - expected: '2960.0000000000', found: '2959.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -