Submission #218335

# Submission time Handle Problem Language Result Execution time Memory
218335 2020-04-02T02:38:43 Z Chancho Balloons (CEOI11_bal) C++14
100 / 100
901 ms 8824 KB
#include <iostream>
#include <stack>
#include <iomanip>

using namespace std;

int main()
{
    int n; cin >> n;
    stack<pair<int,long double>> s;
    for(int i=0;i<n;i++){
        long double x,r; cin >> x >> r;
        while(!s.empty()){
            int X = s.top().first; double R = s.top().second;
            r = min(r,(x-X)*(x-X)/(4*(R)));
            if(r < R){
                break;
            }
            s.pop();
        }
        s.push({x,r});
        cout << fixed << setprecision(3) << r << "\n";
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 12 ms 384 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 89 ms 936 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 213 ms 1368 KB 50000 numbers
2 Correct 224 ms 2424 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 434 ms 1912 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 496 ms 2040 KB 115362 numbers
2 Correct 529 ms 3448 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 666 ms 2260 KB 154271 numbers
2 Correct 901 ms 8824 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 854 ms 2296 KB 200000 numbers
2 Correct 871 ms 5624 KB 199945 numbers