Submission #768197

# Submission time Handle Problem Language Result Execution time Memory
768197 2023-06-27T16:49:30 Z vjudge1 Balloons (CEOI11_bal) C++17
100 / 100
436 ms 12872 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N=2e5, pi=3.14;
int n;
struct dt{
    double x,r;
};
double Ri(dt b, dt c){
    return (b.x-c.x)*(b.x-c.x)/(4*c.r);
}
double area(dt b){
    return b.r*b.r*3.14;
}
dt a[N+10];
deque<dt> q;
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i].x>>a[i].r;
    for (int i=1;i<=n;i++){
        double R = a[i].r;
        while(!q.empty()){
            R = min(R,Ri(a[i],q.back()));
            if (R<q.back().r)
                break;
            else
                q.pop_back();
        }
        q.push_back({a[i].x,R});
        if (R != a[i].r) R-=0.000000001;
        cout <<fixed<<setprecision(9)<<R<<endl;

    }

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 1 ms 340 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1152 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 97 ms 2916 KB 50000 numbers
2 Correct 97 ms 3464 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 213 ms 5148 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 228 ms 5924 KB 115362 numbers
2 Correct 232 ms 7920 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 332 ms 7572 KB 154271 numbers
2 Correct 388 ms 12872 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 436 ms 9376 KB 200000 numbers
2 Correct 397 ms 12860 KB 199945 numbers