Submission #1059672

# Submission time Handle Problem Language Result Execution time Memory
1059672 2024-08-15T06:58:03 Z Mazhavil Balloons (CEOI11_bal) C++17
30 / 100
152 ms 7512 KB
#include<bits/stdc++.h>
using namespace std;

void solve(){
   int n;cin>>n;
   vector<int>x(n), limit(n);
   for(int i=0;i<n;i++)cin>>x[i]>>limit[i];

   vector<double>radius(n);
   stack<int>st;

   for(int i=0;i<n;i++){
    double val_i = 1.0*limit[i];

    while(!st.empty()){ 
        // just touching the balloon;
        double curr = 1.0*(x[i]-x[st.top()])*(x[i]-x[st.top()])/(4*radius[st.top()]);

        if(curr < val_i){            
            val_i = curr;            
        }

        if(val_i >= radius[st.top()]){
              st.pop();  
        }else{
            break;
        }
    }

    st.push(i);
    radius[i]=val_i;
   }

   for(int i=0;i<n;i++)cout<<radius[i]<<" ";
   cout<<endl;
}

int main(){
    int tt=1;
    //cin>>tt;
    while(tt--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 352 KB 1st numbers differ - expected: '247294217.0000000000', found: '247294000.0000000000', error = '217.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 448 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1116 KB 2953rd numbers differ - expected: '1030.4380000000', found: '1030.4400000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 2100 KB 251st numbers differ - expected: '15123.0020000000', found: '15123.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 3920 KB 285th numbers differ - expected: '7629.0020000000', found: '7629.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 4388 KB 511th numbers differ - expected: '4494.0050000000', found: '4494.0100000000', error = '0.0050000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 5720 KB 164th numbers differ - expected: '1698.0020000000', found: '1698.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 7512 KB 248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -