Submission #435281

# Submission time Handle Problem Language Result Execution time Memory
435281 2021-06-23T06:57:21 Z harshith828 Balloons (CEOI11_bal) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
 
double get_min(double x1,double x2){
    if(x1 > x2){
        return x2;
    }
    return x1;
} 

int main(){
    
    long long int n;
    cin >> n;
    stack<pair<long long int,double>> s;
    long long int x,r;
    vector<long double> v;
    for(int i = 0;i < n;i++){
        cin >> x >> r;
        long double radius;
        if(s.empty()){
            radius = r;
            v.push_back(radius);
            s.push(make_pair(x,radius));
            continue;
        }
        while(!s.empty() and (s.top()).first + (s.top()).second >= x - r){
            radius = get_min((((pow((s.top()).first - x,2)))/(4.000*(s.top()).second)),r);
            if(radius > s.top().second){
                s.pop();
            }
            else{
                break;
            }
        }
        v.push_back(radius);
        s.push(make_pair(x,radius));
    }
    for(int i = 0;i < n;i++){
        if(i != n - 1){
             cout << fixed << setprecision(5);<< v[i] << "\n";
        }
        else{
             cout << fixed << setprecision(5); << v[i];
        }
    }
    return 0;
}

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:42:47: error: expected primary-expression before '<<' token
   42 |              cout << fixed << setprecision(5);<< v[i] << "\n";
      |                                               ^~
bal.cpp:45:48: error: expected primary-expression before '<<' token
   45 |              cout << fixed << setprecision(5); << v[i];
      |                                                ^~