Submission #573363

# Submission time Handle Problem Language Result Execution time Memory
573363 2022-06-06T12:57:51 Z codebuster_10 Balloons (CEOI11_bal) C++17
100 / 100
274 ms 5404 KB
#include <bits/stdc++.h>
using ld = long double;
typedef std::pair<ld,ld> pll;
ld raio(ld d,ld r2){
    return (d*d)/(4*r2);
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    int N;
    std::cin>>N;
    std::stack<pll> stack;
    for(int _ = 0;_!=N;++_){
        ld x,r;
        std::cin>>x>>r;
        while(stack.size()){
            ld l = raio(stack.top().first-x,stack.top().second);
            l=std::min(l,r);
            if(l>=stack.top().second){
                stack.pop();
                r=std::min(l,r);
            }else {
                r=l;
                break;
            }
        }
        stack.push({x,r});
        std::cout<<std::fixed<<std::setprecision(3)<<r<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 28 ms 468 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 62 ms 1020 KB 50000 numbers
2 Correct 65 ms 1608 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 121 ms 1384 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 166 ms 1676 KB 115362 numbers
2 Correct 137 ms 3436 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 208 ms 2148 KB 154271 numbers
2 Correct 215 ms 5404 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 230 ms 2124 KB 200000 numbers
2 Correct 274 ms 5368 KB 199945 numbers