We will hold UNIQUE VISION Programming Contest 2024 Christmas (AtCoder Beginner Contest 385).
- Contest URL: https://atcoder.jp/contests/abc385
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20241221T2100&p1=248
- Duration: 100 minutes
- Writer: sotanishy, kyopro_friends, physics0523, blackyuki
- Tester: yuto1115, cn449
- Rated range: ~ 1999
- The point values: 100-200-350-425-450-525-600
We are looking forward to your participation!
I`m so happy
Merry Christmas! Good luck.
Merry Christmas! Last AtCoder contest before Christmas :)
I'll participate it. JUST 8 MINUTES LATER.
Can the dots that Santa Claus passes by be negative
Yes
thank you
AtCoder try not to make multiple problems with the same theme just bigger constraints challenge: IMPOSSIBLE
Santa Claus will come in 3 days!
Why set the precision of F to 10^-9, even though its solution is real number binary search? It is quite annoying to deal with precision issue.
Edit: the official solution is not real number binary search.
__float128 works here, although you'll have to limit number of iterations in binary search to avoid TL.
does solution of $$$F$$$ contain some elements of geometric right angle triangle calculation?Yes or No?
HELP — Can anybody help with this solution of D,it fails 3 testcases for some reason.
Why were you using same map for both x and y coordinates? I made two seperate maps for both in your code and it passed. Link
Thanks for your help,this is too stupid a mistake.
I guess it's because you are using the same map for both x and y?
i gave an absolute brute force solution to the C and it got AC
I think may be because of the constraints.
For problem G. I got this dp
Which is the coefficients of this polynomial $$$(x+1)(x+2)(x+3)...(x+n)$$$ which is equal the stirling numbers of first kind, but failed to get this is $$$O(n)$$$ or $$$O(n log n)$$$, only thought about an $$$O(n log^2 n)$$$ fft solution but didn't even code it.
Update: It is faster than I thought.. submission
I wasted 40min because I wrote 'continue' as 'break'.
:(
congratulations
can someone give solution for 3rd question ? by the way where can we find the solutions of atcoder contest (this was my first atcoder contest ).
here
https://atcoder.jp/contests/abc385/editorial
For each possible starting position (i): For each possible interval length (d): Count how many buildings we can select starting from position i, moving with interval d, while maintaining the same height Update maximum count if current sequence is longer
Why doesn't binary search work for F? Is it because the required precision is not achievable under the given constraints for the iterations of the binary search?
why not just O(n)?
I also did binary search. I am getting 3 cases WA.
https://atcoder.jp/contests/abc385/submissions/60993138
Me too. That's why I was trying to cheese it in somehow, but it just didn't work.
Long double isn't precise enough, probably
__float128
will work.Can anyone help as to why my submission for F is failing on 1 test case and I'm unable to decipher what is wrong with it. my submission
For problem F, why do i set the upper bound of binary search 2e18 WA but 1LL<<60 accept??? code 2e18 code 1LL<<60
wait. what !!! . lemme try. I am getting WA for 2e18.
UPDATE :
Tried with (1LL<<60) , doesn't work for me.
Can you please check what's wrong ?
https://atcoder.jp/contests/abc385/submissions/60996263
Can't we just do it in O(n). Just comparing adjacent heights, I didn't pass it though, my submission but someone else did almost the same and it passed all . Can anyone help me out with what is the difference?
you right, we can do it in O ( N ), but why over-complicate things with Monotonic stack and all. When there is easier Binary search available. ??
Question doesn't demand O ( N ) , it accepts O ( N * log(range ) ) . So, that's why many people opted for BS.
Check my submission I did not use any stack just a single loop. Also the other submission used the same logic and passed all the cases.
ohk, I didn't spend much time on O(N) logic process. but you are right, it is doable.
Can you let me know what is wrong with my code, its failing on 1 test case out of 27 and the other one uses the same logic but passes all.
How to solve problem F?
Binary search.
First try to fix a point on some height, and see if all the buildings are visible from this point. If all buildings are visible from this point, then. your answer lies in bottom half, otherwise, answer lies on upper half.
I tried O(n) with single loop check my submission above.
How can I solve problem F? I use a binary search to find out the answer, but it got wa. I think my precision of my answer has been hacked, but I can't fix it. So can anyone help me?
Sorry for my poor English.
Here is my code.
Pls share link, instead of the code. Or use
"Paste your code here."
...I guess more so many people are on same boat.
https://atcoder.jp/contests/abc385/submissions/60995626
Oh, sorry.
Change
r
to1e18
and it works. This is for the case when there's $$$(999999999, 10^9)$$$ and $$$(10^9, 1)$$$.It really worked! Thank you!
D>>F>E
What was the approach to solve E, I had no clue
brute force on all possible roots
Why though ? In D, I simply used binary search on every range of coordinates Santa would travel on the two maps is maintained. I just deleted appropriate coordinates just once. Here is the submission.
The difficulty of F is centred on the consideration of the boundary case, and the precision.
But we can just do it in O(n) with single loop though
Yep. But what I meant could be this test example:
For me I got WA with
double
, but AC withlong double
. The reason is that the precision of F was set to 10^-9.Can you let me know if that is the reason why my submission fails in exactly 1 test case?
submission
Thanks!! So the question was basically testing us on using the right variables
Please don't set such high precision requirements! Is there a difference between 1e-6 and 1e-9? A lot of people find the right solution but can't break the limits of floating-point accuracy. Such a high precision requirement is difficult to meet and does not improve the "mental difficulty" of the problem, so it is meaningless. (Sorry for the bad translation software.)
Same I got WA on 1 test case with setprecision(12) sadge
If you use struct to hold the number as fraction $$$\frac{a}{b}$$$,it will be easy to only output a number like $$$\frac{a}{b}$$$ at the end,so that the precision requirements is not that harsh.
Some body please tell me what is Wrong in this code for question D
I think there are some major issues in Problem $$$F$$$. Kindly check this submission.
We can observe the following:
The first one is correct behavior according to the definition in the problem
From a point P with coordinate x and height h, building i is considered visible if there exists a point Q on building i such that the line segment PQ does not intersect with any other building.
For the second one, I guess it would work as long as $$$L = 0, R = 2^k$$$ for big enough $$$k$$$? Not sure how to estimate the error but it feel reasonable to have less error when $$$R$$$ is power of $$$2$$$ since computer store everything in binary. I also trapped on this one, guess it's a lesson to learn :P
For the $$$1^{st}$$$ point, what if the line touches the top point of some intermediary building first before reaching the final building? The tests show that in this case, whether the final building will be considered visible or not, is different between $$$H=0$$$ and $$$H>0$$$, which is a contradiction. Kindly check the boolean arg 'isEqualVisible' in the submission in my previous comment.
Let $$$x$$$ be the smallest real number s.t. there are at least two building intersect with the line, then the range of real number to be able to see all building is $$$(x, \infty)$$$. When $$$x \ge 0$$$, output $$$x$$$ is consider correct just because it have arbitrarily small relative error to the correct answer rather than it's visible on $$$x$$$, and when $$$x < 0$$$, $$$0$$$ is visible and the problem ask you to output $$$-1$$$ in such case.
For this part "and for $$$x=0$$$, $$$x$$$ is still invisible and the problem ask you to output $$$−1$$$ in such case", I think you meant we are asked to output $$$-1$$$ if the buildings are visible with $$$x = 0$$$.
Considering this submission, the only difference between it and the other one is that now I am passing $$$false$$$ at line $$$50$$$. The impact this change will make is that the checking function '$$$can()$$$' will consider a building as invisible if its slope is equal to the slope of the building before it, which is the case we are discussing (this is done with the help of the function $$$eq()$$$, which considers the difference absolute value for more accurate equality between floating point values). We are getting 'Wrong answer' with this. Even if this is due to deep precision aspects, I believe it is very confusing.
Hmm, seems it's indeed weird, not sure why change of that flag would cause such difference
Oh this is a fun contest,but I think D is kinda complicated so that I waste much time on it
Why am I getting wrong answer if I use binary search in E problem as if we can see from H height, then we can see from all heights greater than that?
Problem G is OEIS-able. Why writers do not check it (especially for problems with few input parameters) before preparing the contest?
Why problem F could be solved with a monotone stack?
I just did the problem E found it easy and fun !!