Submission #485193

#TimeUsernameProblemLanguageResultExecution timeMemory
485193NeosBalloons (CEOI11_bal)C++14
0 / 100
84 ms4600 KiB
#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;
double p[N], r[N];
stack<int> st;

int main() {
    scanf("%d", &n);
    forw(i, 0, n) {
        scanf("%ld %ld", &p[i], &r[i]);
        while (sz(st)) {
            int j = st.top();
            r[i] = min(r[i], (p[j] - p[i]) * (p[j] - p[i]) / (4 * r[j]));
            if (r[i] >= r[j]) st.pop(); else break;
        }
        st.push(i);
        printf("%.3lf\n", r[i]);
    }
}

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:43:18: warning: format '%ld' expects argument of type 'long int*', but argument 2 has type 'double*' [-Wformat=]
   43 |         scanf("%ld %ld", &p[i], &r[i]);
      |                ~~^       ~~~~~
      |                  |       |
      |                  |       double*
      |                  long int*
      |                %le
bal.cpp:43:22: warning: format '%ld' expects argument of type 'long int*', but argument 3 has type 'double*' [-Wformat=]
   43 |         scanf("%ld %ld", &p[i], &r[i]);
      |                    ~~^          ~~~~~
      |                      |          |
      |                      long int*  double*
      |                    %le
bal.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
bal.cpp:43:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |         scanf("%ld %ld", &p[i], &r[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...