Submission #858114

# Submission time Handle Problem Language Result Execution time Memory
858114 2023-10-07T12:21:24 Z ColourAttila Balloons (CEOI11_bal) C++17
20 / 100
387 ms 6800 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 int maxN = 2e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;

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

int main() {
   InTheNameOfGod;

    int n;
    cin >> n;

    vector<pair<double, double> > v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i].first >> v[i].second;
    }
    vector<int> ind;
    ind.push_back(0);
    vector<double> mo = {v[0].second};
    for(int i = 1; i < n; i++) {
        while(ind.size() > 1 && val(v[i].first-v[ind[ind.size()-2]].first, mo[ind[ind.size()-2]]) <= val(v[i].first-v[ind[ind.size()-1]].first, mo[ind[ind.size()-1]])) {
            ind.pop_back();
        }
        int j = ind.back();
        double x = v[i].first - v[j].first;
        double mini = min(v[i].second, val(x, mo[j]));
        mo.push_back(mini);
        while(!ind.empty() && mo[ind.back()] < mini) ind.pop_back();
        ind.push_back(i);
    }
    cout << fixed << setprecision(3);
    for(int i = 0; i < n; i++) cout << mo[i] << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 53rd numbers differ - expected: '213.0000000000', found: '235.0000000000', error = '22.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 348 KB 504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 1112 KB 653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 2124 KB 14174th numbers differ - expected: '0.7720000000', found: '1.3710000000', error = '0.5990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 198 ms 3812 KB 7447th numbers differ - expected: '0.9750000000', found: '8.0000000000', error = '7.0250000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 229 ms 4420 KB 4793rd numbers differ - expected: '0.9540000000', found: '10.6220000000', error = '9.6680000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 301 ms 5596 KB 1785th numbers differ - expected: '2.2550000000', found: '10.0000000000', error = '7.7450000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 387 ms 6800 KB 2914th numbers differ - expected: '0.8600000000', found: '9.0000000000', error = '8.1400000000'
2 Halted 0 ms 0 KB -