Submission #485094

# Submission time Handle Problem Language Result Execution time Memory
485094 2021-11-06T07:30:49 Z Neos Balloons (CEOI11_bal) C++14
0 / 100
3 ms 332 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() {
#ifndef ONLINE_JUDGE
    freopen(task".inp", "r", stdin);
    freopen(task".out", "w", stdout);
#endif
    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';
    }
}

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:45:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |     freopen(task".inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bal.cpp:46:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |     freopen(task".out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Unexpected end of file - double expected
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Unexpected end of file - double expected
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Unexpected end of file - double expected
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Unexpected end of file - double expected
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Unexpected end of file - double expected
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Unexpected end of file - double expected
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -