Submission #590970

# Submission time Handle Problem Language Result Execution time Memory
590970 2022-07-06T16:15:57 Z Charizard2021 Balloons (CEOI11_bal) C++17
100 / 100
604 ms 5636 KB
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
typedef pair<ld,ld> pll;
ld raio(ld d,ld r2){
    return (d*d)/(4*r2);
}
int main(){
    int N;
    cin >> N;
    stack<pll> stack;
    for(int _ = 0;_ < N;++_){
        ld x,r;
        cin >> x >> r;
        while(stack.size()){
            ld l = raio(stack.top().first-x,stack.top().second);
            l = min(l,r);
            if(l >= stack.top().second){
                stack.pop();
                r = min(l,r);
            }else {
                r = l;
                break;
            }
        }
        stack.push({x,r});
        cout << fixed << setprecision(3)<<r<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 58 ms 748 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 181 ms 1776 KB 50000 numbers
2 Correct 157 ms 1584 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 330 ms 2872 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 356 ms 3312 KB 115362 numbers
2 Correct 407 ms 3404 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 480 ms 4220 KB 154271 numbers
2 Correct 588 ms 5452 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 585 ms 4544 KB 200000 numbers
2 Correct 604 ms 5636 KB 199945 numbers