Submission #473110

# Submission time Handle Problem Language Result Execution time Memory
473110 2021-09-15T07:43:28 Z MohammadAghil Balloons (CEOI11_bal) C++14
10 / 100
273 ms 14320 KB
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int, int> pp;
#define rep(i,l,r) for(int i = (l); i < r; i++)
#define per(i,r,l) for(int i = (r); i >= l; i--)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define ff first
#define ss second 
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
const ll mod = 1e9 + 7, maxn = 2e3 + 10, inf = 1e18;

int main(){
    cin.tie(0) -> sync_with_stdio(0);
    int n; cin >> n;
    vector<long double> x(n), r(n), st, ans(n);
    rep(i,0,n){
        cin >> x[i] >> r[i];
    }
    cout << fixed << setprecision(5);
    rep(i,0,n){
        long double rx = r[i];
        while(sz(st)){
            rx = min(rx, (long double)(x[i] - x[st.back()])*(x[i] - x[st.back()])/(4.*r[st.back()]));
            if(rx >= ans[st.back()]) st.pop_back();
            else break;
        }
        ans[i] = rx;
        st.pb(i);
        cout << ans[i] << ' ';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 5th numbers differ - expected: '17.1630000000', found: '4.3706900000', error = '12.7923100000'
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 5th numbers differ - expected: '0.1170000000', found: '0.0833300000', error = '0.0336700000'
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 456 KB 3rd numbers differ - expected: '121.0000000000', found: '120.0182900000', error = '0.9817100000'
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1624 KB 3rd numbers differ - expected: '211.0000000000', found: '210.0105600000', error = '0.9894400000'
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 4064 KB 3rd numbers differ - expected: '15396.0000000000', found: '9489.3934600000', error = '5906.6065400000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 141 ms 7576 KB 3rd numbers differ - expected: '7936.0000000000', found: '6084.6244400000', error = '1851.3755600000'
# Verdict Execution time Memory Grader output
1 Incorrect 165 ms 8804 KB 6th numbers differ - expected: '5053.0000000000', found: '5052.0004500000', error = '0.9995500000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 222 ms 11536 KB 3rd numbers differ - expected: '1872.0000000000', found: '1871.0012000000', error = '0.9988000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 273 ms 14320 KB 3rd numbers differ - expected: '2960.0000000000', found: '2959.0007600000', error = '0.9992400000'
2 Halted 0 ms 0 KB -