제출 #1167578

#제출 시각아이디문제언어결과실행 시간메모리
1167578LmaoLmaoBalloons (CEOI11_bal)C++20
100 / 100
286 ms8272 KiB
#include<bits/stdc++.h>
#define fi first
#define se second
#define name ""
#define int long long
using namespace std;

using ll = long long;
using ii = pair<ll, ll>;
using aa = array<int,3>;

long double a[2000005][2];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen(name".inp", "r", stdin);
    //freopen(name".out", "w", stdout);
    int n;
    cin >> n;
    stack<int> st;
    for(int i=1;i<=n;i++) {
      long double r;
      cin >> a[i][0] >> r;
      while(!st.empty()) {
        int cur=st.top();
        long double res=(a[cur][0]-a[i][0])*(a[cur][0]-a[i][0])/(4*a[cur][1]);
        r=min(r,res);
        if(r>=a[cur][1])  {
          st.pop();
        } else break;
      }
      st.push(i);
      a[i][1]=r;
      cout << fixed << setprecision(3) << r << endl;
    }
    return 0;
}

/*
██╗░░██╗██╗░░██╗░█████╗░███╗░░██╗░██████╗░              ░██████╗██╗██╗░░░██╗                ░█████╗░██╗░░░██╗████████╗███████╗
██║░██╔╝██║░░██║██╔══██╗████╗░██║██╔════╝░              ██╔════╝██║██║░░░██║                ██╔══██╗██║░░░██║╚══██╔══╝██╔════╝
█████═╝░███████║███████║██╔██╗██║██║░░██╗░              ╚█████╗░██║██║░░░██║                ██║░░╚═╝██║░░░██║░░░██║░░░█████╗░░
██╔═██╗░██╔══██║██╔══██║██║╚████║██║░░╚██╗              ░╚═══██╗██║██║░░░██║                ██║░░██╗██║░░░██║░░░██║░░░██╔══╝░░
██║░╚██╗██║░░██║██║░░██║██║░╚███║╚██████╔╝              ██████╔╝██║╚██████╔╝                ╚█████╔╝╚██████╔╝░░░██║░░░███████╗
╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝░╚═════╝░              ╚═════╝░╚═╝░╚═════╝░                ░╚════╝░░╚═════╝░░░░╚═╝░░░╚══════╝
*/
#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...