ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1159. Fence

wa 1,2,3, ..., 12
Posted by 👑TIMOFEY👑`~ 5 Aug 2024 21:32
"If it is not possible to construct the fence from the specified blocks, write 0.00." - dementia

binary search from the maximum side across the floors to infinity is a bad idea - a ternary search is better suited, it can be run over all segments equal in length to the root from infinity, and also for prevention it is worth adding a few additional random segments (about 10,000)
I would highlight a few good infinities such as 5e6, 1e8, 1e10, 1e6, 1e5, 2.625e6

The order of the walls is not important

#define ld long double

ld arcsin(ld k) {
    if (k >= 1) {
        k = 1;
    }
    if (k <= -1) {
        k = -1;
    }

    return asinl(k);
}
(I hope you won't need this feature.)

i think 1e-10 nice eps, but i dont sure