Submission #223414

# Submission time Handle Problem Language Result Execution time Memory
223414 2020-04-15T08:55:26 Z dolphingarlic Balloons (CEOI11_bal) C++14
100 / 100
185 ms 7384 KB
#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

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 time Memory Grader output
1 Correct 5 ms 384 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 22 ms 768 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 55 ms 1656 KB 50000 numbers
2 Correct 42 ms 2040 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 95 ms 2808 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 114 ms 3192 KB 115362 numbers
2 Correct 105 ms 4628 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 151 ms 4088 KB 154271 numbers
2 Correct 159 ms 7288 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 185 ms 4620 KB 200000 numbers
2 Correct 167 ms 7384 KB 199945 numbers