Submission #485116

# Submission time Handle Problem Language Result Execution time Memory
485116 2021-11-06T08:17:07 Z dz001 Balloons (CEOI11_bal) C++11
60 / 100
758 ms 6548 KB
#include <bits/stdc++.h>
using namespace std;
 
#define sqr(x) (x)*(x)
 
const double eps=1e-3;
const int N=2e5+10;
double ans[N];
long long x[N],R[N];
int n;
 
double get(int i,int j){
    return (min(1.*R[i],sqr(x[i]-x[j])/(4.*ans[j])));
}
 
signed main()
{
    ios::sync_with_stdio(NULL);
    cin.tie(nullptr);
    cout.precision(3);
    cout<<fixed;
 
    cin>>n;
    for(int i=0;i<n;++i)cin>>x[i]>>R[i];
 
    ans[0]=R[0];
    for(int i=1;i<n;++i){
        for(int j=max(0,i-1000);j<i;++j){
            double tmp=get(i,j);
            // cout<<tmp<<endl;
            if(ans[i]>=tmp||ans[i]==0)ans[i]=tmp;
        }
    }
 
    for(int i=0;i<n;++i)cout<<ans[i]<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 6 ms 332 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 77 ms 852 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 201 ms 1808 KB 50000 numbers
2 Incorrect 188 ms 1756 KB 49903rd numbers differ - expected: '443977872.4679999948', found: '1000000000.0000000000', error = '556022127.5320000648'
# Verdict Execution time Memory Grader output
1 Correct 407 ms 3568 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 430 ms 3912 KB 115362 numbers
2 Incorrect 445 ms 3780 KB 119952nd numbers differ - expected: '444418084.8249999881', found: '1000000000.0000000000', error = '555581915.1749999523'
# Verdict Execution time Memory Grader output
1 Correct 627 ms 5284 KB 154271 numbers
2 Incorrect 726 ms 6140 KB 200000th numbers differ - expected: '999999998.0000000000', found: '1000000000.0000000000', error = '2.0000000000'
# Verdict Execution time Memory Grader output
1 Correct 749 ms 6548 KB 200000 numbers
2 Incorrect 758 ms 6148 KB 199941st numbers differ - expected: '80461337.7310000062', found: '1000000000.0000000000', error = '919538662.2690000534'