Submission #1116647

# Submission time Handle Problem Language Result Execution time Memory
1116647 2024-11-22T03:33:22 Z Bananabread Balloons (CEOI11_bal) C++17
100 / 100
123 ms 4512 KB
#include<bits/stdc++.h>
#define ll int
#define ntr "\n"
#define mod (ll)(1e9+7)
#define taskname "BALLOONS"
#define frep freopen(taskname".inp","r",stdin); freopen(taskname".out","w",stdout);
using namespace std;
ll n;
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //frep;
    cin>>n;
    cout<<fixed<<setprecision(3);
    stack<pair<ll, double>> st;
    for(int i=1;i<=n;i++){
        ll x;
         double r;
        cin>>x>>r;
        while(!st.empty()){
            pair<ll, double> curr=st.top();
            r=min(r,( double)1LL*(x-curr.first)*(x-curr.first)/(4.0*curr.second));
            if(r>curr.second){
                st.pop();
                continue;
            }
            else{
                break;
            }
        }
        st.push({x,r});
        cout<<r<<ntr;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 13 ms 592 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 38 ms 848 KB 50000 numbers
2 Correct 30 ms 1104 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 66 ms 1352 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 77 ms 1608 KB 115362 numbers
2 Correct 72 ms 2120 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 107 ms 1776 KB 154271 numbers
2 Correct 121 ms 4388 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 123 ms 1876 KB 200000 numbers
2 Correct 119 ms 4512 KB 199945 numbers