Submission #433143

# Submission time Handle Problem Language Result Execution time Memory
433143 2021-06-19T00:34:08 Z jli12345 Balloons (CEOI11_bal) C++14
100 / 100
209 ms 10892 KB
#include <bits/stdc++.h>
using namespace std;

int N;
pair<long long, double> arr[200100];

double ans[200100];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N;
    for (int i = 1; i <= N; i++){
        cin >> arr[i].first >> arr[i].second;
    }
    stack<int> s;
    for (int i = 1; i <= N; i++){
        double rad = arr[i].second;
        while (!s.empty()){
            rad = min(rad, pow((arr[i].first-arr[s.top()].first), 2)/(4*ans[s.top()]));
            rad = min(rad, arr[i].second);
            if (rad > ans[s.top()])
                s.pop();
            else
                break;
        }
        s.push(i);
        ans[i] = rad;
    }
    for (int i = 1; i <= N; i++){
        cout << fixed << setprecision(5) << ans[i] << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 22 ms 904 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 53 ms 1952 KB 50000 numbers
2 Correct 55 ms 2892 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 110 ms 3648 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 128 ms 4212 KB 115362 numbers
2 Correct 123 ms 6692 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 175 ms 5636 KB 154271 numbers
2 Correct 205 ms 10892 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 209 ms 6980 KB 200000 numbers
2 Correct 203 ms 10888 KB 199945 numbers