Submission #435233

# Submission time Handle Problem Language Result Execution time Memory
435233 2021-06-23T05:55:26 Z harshith828 Balloons (CEOI11_bal) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;

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

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:18:96: error: expected primary-expression before ')' token
   18 |         if(!s.empty() and (s.top()).first + (s.top()).second >= x - r and r < (s.top()).second)){
      |                                                                                                ^