Submission #888615

#TimeUsernameProblemLanguageResultExecution timeMemory
888615a5a7Balloons (CEOI11_bal)C++14
0 / 100
172 ms4848 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    pair<double, double> v[n];
    for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
    stack<pair<double, double>> s;
    for (int i = 0; i < n; i++){
        double radius = v[i].second;
        double x2 = v[i].first;
        while (!s.empty()){
            double x1 = s.top().first, r1 = s.top().second;
            double r2 = (x1-x2)*(x1-x2)/(4*r1);
            radius = min(r2, radius);
            if (r2 > r1){
                s.pop();
            }else{
                break;
            }
        }
        printf("%.4Lf\n", radius);
        s.push(make_pair(x2, radius));
    }
}

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:24:21: warning: format '%Lf' expects argument of type 'long double', but argument 2 has type 'double' [-Wformat=]
   24 |         printf("%.4Lf\n", radius);
      |                 ~~~~^     ~~~~~~
      |                     |     |
      |                     |     double
      |                     long double
      |                 %.4f
#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...