제출 #1144137

#제출 시각아이디문제언어결과실행 시간메모리
1144137gulmixBalloons (CEOI11_bal)C++20
100 / 100
108 ms3556 KiB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using namespace std;
#define all(x) x.begin(), x.end()

int main(){
   ios::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);
   //ifstream cin("cycle2.in");
   //ofstream cout("cycle2.out");
   ll n; cin >> n;
   vector<double> ans(n);
   stack<pair<double, double>> st;
   for(int i = 0; i < n; i++){
      double x, r; cin >> x >> r;
      double cur = r;
      while(!st.empty()){
         pair<double, double> prev = st.top();
         double to_prev = (prev.first - x) * (prev.first - x) / (4 * prev.second);
         cur = min(cur, to_prev);
         if(cur >= prev.second){
            st.pop();
            continue;
         }else{
            break;
         }
      }
      st.push({x, cur});
      ans[i] = cur;
   }
   cout << fixed << setprecision(3);
   for(auto &i: ans){
      cout << i << '\n';
   }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...