Submission #485114

# Submission time Handle Problem Language Result Execution time Memory
485114 2021-11-06T08:15:38 Z dz001 Balloons (CEOI11_bal) C++11
50 / 100
193 ms 6612 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-100);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 332 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 2 ms 332 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 22 ms 940 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 1884 KB 27818th numbers differ - expected: '4.2990000000', found: '10.0000000000', error = '5.7010000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 106 ms 3408 KB 7966th numbers differ - expected: '13.4810000000', found: '32.3630000000', error = '18.8820000000'
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 3988 KB 5083rd numbers differ - expected: '5067.4220000000', found: '5075.0000000000', error = '7.5780000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 156 ms 5280 KB 154271 numbers
2 Incorrect 181 ms 6128 KB 200000th numbers differ - expected: '999999998.0000000000', found: '1000000000.0000000000', error = '2.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 193 ms 6612 KB 4491st numbers differ - expected: '1407.5340000000', found: '1642.0000000000', error = '234.4660000000'
2 Halted 0 ms 0 KB -