Submission #485097

# Submission time Handle Problem Language Result Execution time Memory
485097 2021-11-06T07:36:40 Z Neos Balloons (CEOI11_bal) C++14
100 / 100
212 ms 8132 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;
    forw(i, 0, n) {
        cin >> p[i] >> r[i];
        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;
        }
        st.push(i);
        cout << fixed << setprecision(3) << r[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 23 ms 1116 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 63 ms 2280 KB 50000 numbers
2 Correct 54 ms 2112 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 110 ms 4268 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 129 ms 4968 KB 115362 numbers
2 Correct 121 ms 4700 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 189 ms 6484 KB 154271 numbers
2 Correct 206 ms 7680 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 212 ms 8132 KB 200000 numbers
2 Correct 203 ms 7748 KB 199945 numbers