Submission #223414

#TimeUsernameProblemLanguageResultExecution timeMemory
223414dolphingarlicBalloons (CEOI11_bal)C++14
100 / 100
185 ms7384 KiB
#include <bits/stdc++.h>
using namespace std;

stack<pair<double, double>> stck;

int main() {
    int n;
    scanf("%d", &n);
    while (n--) {
        double x, r;
        scanf("%lf %lf", &x, &r);
        while (stck.size()) {
            r = min(r, (x - stck.top().first) * (x - stck.top().first) / stck.top().second / 4);
            if (r > stck.top().second) stck.pop();
            else break;
        }
        stck.push({x, r});
        printf("%.3lf\n", r);
    }
    return 0;
}

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
bal.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lf %lf", &x, &r);
         ~~~~~^~~~~~~~~~~~~~~~~~~
#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...