Submission #1105038

# Submission time Handle Problem Language Result Execution time Memory
1105038 2024-10-25T08:28:59 Z ezzzay Balloons (CEOI11_bal) C++14
100 / 100
236 ms 9820 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
double x[N],r[N];
signed main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x[i]>>r[i];
    }
    vector<int>v;
    for(int i=1;i<=n;i++){
        while(!v.empty()){
            int j=v.back();
            r[i]=min(r[i],(x[i]-x[j])*(x[i]-x[j])/4/r[j]);
            if(r[i]<r[j])break;
            v.pop_back();
        }
        
        
        v.pb(i);
    }
    for(int i=1;i<=n;i++){
        cout<<fixed<<setprecision(3)<<r[i]<<" ";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2384 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2896 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 92 ms 5960 KB 50000 numbers
2 Correct 50 ms 5852 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 93 ms 7004 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 112 ms 6728 KB 115362 numbers
2 Correct 128 ms 7776 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 174 ms 8036 KB 154271 numbers
2 Correct 236 ms 9820 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 205 ms 9048 KB 200000 numbers
2 Correct 218 ms 9800 KB 199945 numbers