Submission #630651

# Submission time Handle Problem Language Result Execution time Memory
630651 2022-08-16T20:12:49 Z Iwanttobreakfree Balloons (CEOI11_bal) C++17
100 / 100
583 ms 6872 KB
#include <iostream>
#include <vector>
#include <stack>
#include <iomanip>
using namespace std;
const long double EPS=1e-9;
long double dist(int x,long double r1,int y){
    return (long double)(x-y)*(x-y)/(4*r1);
}
int main(){
    int n,x;
    long double r;
    cin>>n;
    stack<pair<int,long double>> st;
    for(int i=0;i<n;i++){
        cin>>x>>r;
        while(st.size()){
            long double ok=dist(st.top().first,st.top().second,x);
            r=min(r,ok);
            if(r>=st.top().second)st.pop();
            else break;
            //cout<<st.size()<<'\n';
        }
        st.push({x,r});
        cout<<fixed<<setprecision(10)<<r<<'\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 62 ms 612 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 161 ms 1392 KB 50000 numbers
2 Correct 159 ms 976 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 302 ms 2100 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 344 ms 2428 KB 115362 numbers
2 Correct 349 ms 4180 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 449 ms 2860 KB 154271 numbers
2 Correct 570 ms 6860 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 572 ms 3424 KB 200000 numbers
2 Correct 583 ms 6872 KB 199945 numbers