Submission #218337

# Submission time Handle Problem Language Result Execution time Memory
218337 2020-04-02T02:40:05 Z Chancho Balloons (CEOI11_bal) C++14
100 / 100
283 ms 4984 KB
#include <iostream>
#include <stack>
#include <iomanip>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    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 384 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 6 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 31 ms 512 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 72 ms 1112 KB 50000 numbers
2 Correct 70 ms 1528 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 157 ms 1528 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 172 ms 1740 KB 115362 numbers
2 Correct 165 ms 1144 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 232 ms 1912 KB 154271 numbers
2 Correct 283 ms 4984 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 269 ms 2044 KB 200000 numbers
2 Correct 267 ms 1784 KB 199945 numbers