Submission #485095

# Submission time Handle Problem Language Result Execution time Memory
485095 2021-11-06T07:32:01 Z Neos Balloons (CEOI11_bal) C++14
10 / 100
211 ms 10952 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define task "bongbong"
#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i, l, r) for( ll i = (l) ; i < (r) ; i++ )
#define forb(i, r, l) for( ll i = (r) ; i >= (l) ; i-- )
#define numBit(x) (__builtin_popcountll(1ll * (x)))
#define getBit(x, i) ((x) >> (i) & 1)
#define sz(x) (int)x.size()
#define mp make_pair
#define fi first
#define se second
#define ar array
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define debug(x) cerr << #x << " = " << x << '\n';

const int N = 2e5 + 7;

int n;
ld p[N], r[N];

ld sqr(ld x) {
    return x * x;
}

int main() {
    fastIO;
    cin >> n;

    stack<int> st;
    st.push(0);
    forw(i, 0, n) {
        cin >> p[i] >> r[i];
        if (!i) {
            cout << fixed << setprecision(3) << r[i] << '\n';
            continue;
        }
        while (sz(st)) {
            int j = st.top();
            r[i] = min(r[i], sqr(p[j] - p[i]) / (4 * r[j]));
            if (r[i] >= r[j]) st.pop();
            else break;
        }
        cout << fixed << setprecision(3) << r[i] << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB 4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000'
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 7th numbers differ - expected: '0.0010000000', found: '9.0000000000', error = '8.9990000000'
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB 3rd numbers differ - expected: '121.0000000000', found: '123.0000000000', error = '2.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1344 KB 3rd numbers differ - expected: '211.0000000000', found: '213.0000000000', error = '2.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 2972 KB 5th numbers differ - expected: '15395.0000000000', found: '15396.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 5724 KB 3rd numbers differ - expected: '7936.0000000000', found: '10352.0000000000', error = '2416.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 6612 KB 5th numbers differ - expected: '5054.0000000000', found: '5055.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 205 ms 8768 KB 3rd numbers differ - expected: '1872.0000000000', found: '1874.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 211 ms 10952 KB 3rd numbers differ - expected: '2960.0000000000', found: '2962.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -