Submission #528338

# Submission time Handle Problem Language Result Execution time Memory
528338 2022-02-20T05:11:47 Z Falcon Balloons (CEOI11_bal) C++17
10 / 100
183 ms 7636 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 (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 1 ms 312 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.9330000000', error = '252735384.5049999952'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 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 3 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 20 ms 964 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 49 ms 2092 KB 3rd numbers differ - expected: '15396.0000000000', found: '-8140.0230000000', error = '23536.0230000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 4176 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 91 ms 4288 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 144 ms 6340 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 183 ms 7636 KB 2735th numbers differ - expected: '1883.4630000000', found: '1899.0000000000', error = '15.5370000000'
2 Halted 0 ms 0 KB -