Submission #528341

# Submission time Handle Problem Language Result Execution time Memory
528341 2022-02-20T05:19:04 Z Falcon Balloons (CEOI11_bal) C++17
20 / 100
201 ms 4884 KB
#include <bits/stdc++.h>

#ifdef DEBUG
    #include "debug.hpp"
#endif

using namespace std;

#define all(c)        (c).begin(), (c).end()
#define rall(c)       (c).rbegin(), (c).rend()
#define rep(i, N)     for (int i = 0; i < (N); ++i)
#define rrep(i, N)    for (int i = (N)-1; i >= 0; --i)
#define rep1(i, N)    for (int i = 1; i <= (N); ++i)
#define rep2(i, s, e) for (int i = (s); i <= (e); ++i)

#ifdef DEBUG
    #define debug(x...)                                                        \
        do {                                                                   \
            ++dbg::depth;                                                      \
            string dbg_vals = dbg::to_string(x);                               \
            --dbg::depth;                                                      \
            dbg::fprint(__func__, __LINE__, #x, dbg_vals);                     \
        } while (false)
#else
    #define debug(...) 42
#endif

template<typename T> inline T& ckmin(T& a, T b) { return a = a > b ? b : a; }
template<typename T> inline T& ckmax(T& a, T b) { return a = a < b ? b : a; }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> x(n);
    vector<double> r(n);

    deque<int> s;

    auto f = [&](int i, int X) -> double {
        return double(X - x[i]) * (X - x[i]) / (4 * r[i]);
    };

    rep(i, n) {
        cin >> x[i] >> r[i];
        while (int(s.size()) >= 2 && f(s[0], x[i]) > f(s[1], x[i]))
            s.pop_front();
        if (!s.empty()) ckmin(r[i], f(s[0], x[i]));
        s.push_front(i);
        cout << fixed << setprecision(3) << r[i] << '\n';
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB 17th numbers differ - expected: '213.0000000000', found: '234.0000000000', error = '21.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB 504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 776 KB 653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 1512 KB 14174th numbers differ - expected: '0.7720000000', found: '1.3710000000', error = '0.5990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 2684 KB 7447th numbers differ - expected: '0.9750000000', found: '8.0000000000', error = '7.0250000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 3136 KB 4793rd numbers differ - expected: '0.9540000000', found: '10.6220000000', error = '9.6680000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 4084 KB 1734th numbers differ - expected: '1856.0220000000', found: '1865.0000000000', error = '8.9780000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 201 ms 4884 KB 2735th numbers differ - expected: '1883.4630000000', found: '1899.0000000000', error = '15.5370000000'
2 Halted 0 ms 0 KB -