Submission #880187

# Submission time Handle Problem Language Result Execution time Memory
880187 2023-11-29T02:28:18 Z lambd47 Balloons (CEOI11_bal) C++14
10 / 100
195 ms 10728 KB
#include<bits/stdc++.h>
using namespace std;
const double INF=1e9+7;
double calc(double p1,double r1,double p2){
    if(r1==0){
        return 0;
    }
    return double ((p2-p1)*(p2-p1))/(4*r1);
}

int main(){
    int n;
    cin>>n;
    vector<double> pos(n);
    vector<double> maxr(n);//maximo
    vector<double> raio(n);
    for(int i=0;i<n;i++){
        cin>>pos[i]>>maxr[i];
    }
    vector<pair<int,int>> fila;
    cout<<fixed<<setprecision(3);
    for(int i=0;i<n;i++){
        while(fila.size()>1 && calc(fila.back().first,fila.back().second,pos[i])>calc(fila[fila.size()-2].first,fila[fila.size()-2].second,pos[i])){
            fila.pop_back();
        }
        if(fila.empty()){
            raio[i]=maxr[i];
        }
        else if(calc(fila.back().first,fila.back().second,pos[i])<maxr[i]){
            raio[i]=calc(fila.back().first,fila.back().second,pos[i]);
        }
        else{
            raio[i]=maxr[i];
        }
        fila.push_back({pos[i],raio[i]});
    }
    for(int i=0;i<n;i++){
        cout<<raio[i]<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 8th numbers differ - expected: '8.7410000000', found: '9.0910000000', error = '0.3500000000'
2 Halted 0 ms 0 KB -
# 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 3rd numbers differ - expected: '0.0420000000', found: '0.0000000000', error = '0.0420000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB 3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1496 KB 44th numbers differ - expected: '165.0000000000', found: '165.0020000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 2952 KB 254th numbers differ - expected: '15129.9990000000', found: '15130.0010000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 5568 KB 286th numbers differ - expected: '7633.9990000000', found: '7634.0010000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 122 ms 6336 KB 511th numbers differ - expected: '4494.0050000000', found: '4494.0070000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 8552 KB 165th numbers differ - expected: '1698.9980000000', found: '1699.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 195 ms 10728 KB 249th numbers differ - expected: '2683.0090000000', found: '2683.0110000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -