Submission #858124

# Submission time Handle Problem Language Result Execution time Memory
858124 2023-10-07T12:31:32 Z ColourAttila Balloons (CEOI11_bal) C++17
10 / 100
385 ms 6772 KB
#include <bits/stdc++.h>
using namespace std;
#define InTheNameOfGod ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
using ll = long long;

const ll maxN = 2e5 + 5;
const ll MOD = 1e12 + 7;
const ll INF = 1e9 + 7;

double val(double x, double r) {
    return x*x/4.0/r;
}

int main() {
   InTheNameOfGod;

    ll n;
    cin >> n;

    vector<pair<double, double> > v(n);
    for(ll i = 0; i < n; i++) {
        cin >> v[i].first >> v[i].second;
    }
    vector<ll> ind;
    ind.push_back(0);
    vector<double> mo = {v[0].second};
    for(ll i = 1; i < n; i++) {
        double mini = val(v[i].first-v[ind[0]].first, mo[ind[0]]);
        int l = 0, r = ind.size()-1;
        while(l <= r) {
            int mid = (l+r)/2;
            if(val(v[i].first-v[ind[mid]].first, mo[ind[mid]]) < mini) {
                mini = val(v[i].first-v[ind[mid]].first, mo[ind[mid]]);
                l = mid+1;
            }
            else r = mid-1;
        }
        mini = min(mini, v[i].second);
        mo.push_back(mini);
        while(!ind.empty() && mo[ind.back()] < mini) ind.pop_back();
        ind.push_back(i);
    }
    cout << fixed << setprecision(3);
    for(ll i = 0; i < n; i++) cout << mo[i] << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 7th numbers differ - expected: '11.4400000000', found: '81.0000000000', error = '69.5600000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 7th numbers differ - expected: '0.0010000000', found: '9.0000000000', error = '8.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 348 KB 3rd numbers differ - expected: '121.0000000000', found: '123.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 1124 KB 3rd numbers differ - expected: '211.0000000000', found: '213.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 2124 KB 14016th numbers differ - expected: '0.0000000000', found: '7.0000000000', error = '7.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 202 ms 3828 KB 3rd numbers differ - expected: '7936.0000000000', found: '10352.0000000000', error = '2416.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 230 ms 4292 KB 4694th numbers differ - expected: '0.0000000000', found: '4.0000000000', error = '4.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 351 ms 5652 KB 3rd numbers differ - expected: '1872.0000000000', found: '1874.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 385 ms 6772 KB 3rd numbers differ - expected: '2960.0000000000', found: '2962.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -