Топ комментариев

New fear unlocked

Come on... releasing the checker and some tests after 10 days of the competition? +Extension

I did most of the work in the first week, and planned to do very little this week. Good luck with that plan now, right?

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+85

Almost toughest Div2. BCD are too hard for their positions and D is the strangest problem of my CP journey...

На prvocisloCodeforces Round #945 (Div. 2), 42 часа назад
+75

meanwhile you are just a troll with no life

На Nummer_64IOI 2024 Teams, 47 часов назад
+70

They brought guns to a fist fight.

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+63

It was the most fun Div.2 ever, thank you!

На waipoliEolymp Weekend Practice #2, 16 часов назад
+55

Guess why

На prvocisloCodeforces Round #945 (Div. 2), 9 часов назад
+49

Very nice round!

На prvocisloCodeforces Round #945 (Div. 2), 28 часов назад
+45

Stop replying with your alts then we can talk

На prvocisloCodeforces Round #945 (Div. 2), 38 часов назад
+44

This is a huge insult. I'm sure I'm not the only one who agrees with.

I don't know if I'm qualified to say this, but can't you be kind to other? Can't you at least be kind enough to not be sarcastic or insult someone who has nothing to do with you and has raised a legitimate issue?

На Nummer_64IOI 2024 Teams, 45 часов назад
+43

United Kingdom's team:

  • Hanks Chong (Hanksburger) — 3rd time, 1 attempt left
  • Samuel Trajtenberg (sammyuri) — 2nd time, 0 attempts left
  • Adavya Goyal (Boomyday12343) — 1st time, 2 attempts left
  • Anango Prabhat (anango) — 1st time, 2 attempts left

Is the checker numerically stable? Will it always add the same numbers to the same value?

I locally got a situation where printing extra stuff in the checker changes the sum that it computes. Maybe that's allowed in C++.

I also created a test where s{a,b,c} != s{s{a,b},c}, but I don't understand float->double->float casting enough to say if this is incorrect.

На prvocisloCodeforces Round #945 (Div. 2), 38 часов назад
+40

as another participant I don't think this is a wise decision. If you don't attempt harder interactive problems you will not improve at them.

На prvocisloCodeforces Round #945 (Div. 2), 31 час назад
+40

Glad the guy finally got served. Never have anything nice to say, just stupid insults and 4chan rhetorics

Why?
"Next, we calculate the expected sum as precisely as we can"
"//'Exact' answer based on Kahan summation"
Or, the Kahan is shown but the expected sum is really exact while testing?
Hope it is.

На Nummer_64IOI 2024 Teams, 43 часа назад
+36

at uni

На Nummer_64IOI 2024 Teams, 45 часов назад
+35

Spain's IOI team is:

  • Alejandro Vivero Puga (Esomer) — 2nd time at IOI, 0 attempts left

  • Javier Badesa Pérez (Dalek_of_Rivia) — 1st time at IOI, 0 attempts left

  • Daniel Nieto Pérez (danx) — 1st time at IOI, 0 attempts left

  • Héctor Verdeal Rodríguez (Hectorungo_18) — 1st time at IOI, 1 attempt left

На moemen_proBinary Search, 32 часа назад
+35

Dyslexic Sparse University of Tartaria

На EduardoBritoOII 2024 Teams, 32 часа назад
+33

Here is the brazilian team:

Good luck guys :D

На prvocisloCodeforces Round #945 (Div. 2), 24 часа назад
+30

Happy birthday! I hope you will enjoy the round :D

На Nummer_64IOI 2024 Teams, 39 часов назад
+27

wait your legendary Aidar Munduzbaev has no attemts left? Sad that he couldnt get gold

Orz!

It seems that people use the rolling hash formula $$$\sum_{j = 0}^{n - 1} q^{n - 1 - j} s_j$$$ more frequently than $$$\sum_{j = 0}^{n - 1} q^{j} s_j$$$. Probably it would be better to have an "reverse the result" option.

На moemen_proBinary Search, 29 часов назад
+26

thank you blog that man good put like for him

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 12 часов назад
+26

My idea for C is slightly different and imo cleaner. Its also much easier to prove why my idea actually works.

Here's my code: 261430375

The explanation

Incase I explained something poorly, please let me know! And I'll try to help if I can. :D

На Nummer_64IOI 2024 Teams, 46 часов назад
+25

Italy:

  • Luca Baglietto (BestCrazyNoob) — 2419.0 points (at the team selection tests), 2nd time, 1 attempt left
  • Francesco Vercellesi (franv) — 2349.6 points, 2nd time, 0 attempts left
  • James Bamber (jamesbamber) — 2303.6 points, 1st time, 0 attempts left
  • Alessandro Lombardo (AlesL0) — 2257.0 points, 2nd time, 0 attempts left

Well, it's added.

На prvocisloCodeforces Round #945 (Div. 2), 19 часов назад
+25
  • Codeforces Round 941 (Div. 1)
  • Codeforces Round 942 (Div. 2)
  • Codeforces Round 943 (Div. 3)
  • Codeforces Round 944 (Div. 4)
  • Any guesses?

Expected sum is not always exact. It is calculated by Kahan summation as in the published checker implementation.

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+23

Lol I thought I was the only one thinking B was odd. Counting prefixes bit-by-bit should be C at least.

На galen_colinshenanigans, 37 часов назад
+22

I messed up guys. It was 7 and I wasn't been able to sleep yet. I decided to go to uni right away. Next frame, it was 12! I have no idea what happened since I even had my alarms on for 8.

I hope we'll have a chance to do this another time.

Feel free to downvote this comment. I messed up and deserve that.

На waipoliEolymp Weekend Practice #2, 15 часов назад
+22
Spoiler
На prvocisloCodeforces Round #945 (Div. 2), 46 часов назад
+21

Plz.start on 17:05(UTC+08) :<

На moemen_proBinary Search, 35 часов назад
+21

what is dsu

На Nummer_64IOI 2024 Teams, 28 часов назад
+21

We have only 11 grades in Kyrgyzstan and I went to school one year early. So yeah, last year was my last chance, despite me being 17 right now. However, this year I will hopefully be in Kyrgyz IOI delegation and help out guys to get the first gold for Kyrgyzstan. Good luck to contestants from all countries.

На prvocisloCodeforces Round #945 (Div. 2), 16 часов назад
+21

Receiving clarifications for A about 7-9 mins into the contest after 1 failed attempt to answer the "original" problem is pretty underwhelming.

Bonus points for MASSIVE confusion after the first submission failed on pretest 1.

На galen_colinshenanigans, 36 часов назад
+20

This never happens again. But, definitely, I will share the channel with them.

На prvocisloCodeforces Round #945 (Div. 2), 25 часов назад
+20

Congratulations prvocislo, looking forward to your round :D

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+20

Out of curiosity, what makes D so strange in your opinion?

It feels fairly normal for a CF interactive problem to me.

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+20

Finally i have reached master

На NeroZein[Discussion Thread] APIO 2024, 39 часов назад
+19

I tried my best to divide the solution into reasonable parts, hopefully it'd be helpful.

init
calc_f

P.S: It appears that there are some similarities between my sol and the sol above, which wasn't there when I started writing the comment.

На prvocisloCodeforces Round #945 (Div. 2), 37 часов назад
+19

I don't know man, telling someone is right after he called you effeminate is just a little weird

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+19

It was very easy to implement, the observation was the difficult part imo.

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+19

Find the maximum element $$$mx$$$ in $$$a$$$ by making queries $$$(1,n*n), (1,n*(n-1)),\dots$$$. If you get $$$r=n$$$ on query $$$(1,n*b)$$$ then $$$mx=b$$$.

Now since this maximum element is present in at least one of the $$$k$$$ subarrays, $$$mx$$$ must divide $$$m$$$. Also, if $$$m=b*mx$$$, every subarray must have length at least $$$b$$$. So we only need to check multiples of $$$mx$$$ upto $$$\frac{n}{k}mx$$$. In each candidate for $$$m$$$, just query $$$k$$$ segments starting from position $$$1$$$ and check if these segments cover the array.

This takes $$$n$$$ queries to find $$$mx$$$ and another $$$n$$$ queries to check all values of $$$m$$$.

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 14 часов назад
+19

prvocislo orz <3

Please no GOD no please. I won't play Genshin any more. Please don't hack my Hash.

← Anonymous Tester

На waipoliEolymp Weekend Practice #2, 16 часов назад
+16

no it is created by Sergey Kolodyazhnyy

На galen_colinshenanigans, 43 часа назад
+15

shayan is awol lol

На MarinushAsk Me Anything!, 37 часов назад
+15

How can I murder someone as inconspicuously as possible

На prvocisloCodeforces Round #945 (Div. 2), 37 часов назад
+15

Honestly, it doesn't matter. There is simply no reason why you should defend the guy.

На prvocisloCodeforces Round #945 (Div. 2), 16 часов назад
+15

Anyone proved the validity of C?

I thought of a greedy solution, check if it's possible to maximize at indices $$$(3, 5, \dots, n-1)$$$ or $$$(2, 4, \dots, n-2)$$$, then take the case with better score.

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+15

The interaction and the output format is very weird. What I expected: I can ask $$$l, r$$$ and the answer will be $$$f(l, r)$$$. (I know that's not interesting because $$$f(l, l)=$$$ $$$a_l$$$) And the output should be the array or some natural proterty of that.

By the way nice problem.

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 14 часов назад
+15

I appreciate it broski but I have also done a lot of leetcode so, between the two platforms, it is normal growth. I think that leetcode is better than codeforces when you are beginning 100%.

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 14 часов назад
+15

Wow rating changes and editorial were kinda fast... speedforces

На MarinushAsk Me Anything!, 47 часов назад
+14

Marinush His comments are more useful for the community than your retarded post and comments. It is you who needs to chill.

Also, you don't need to write your username in your every fucking comment. We can see your username with our own eyes. We are not blind either

На galen_colinshenanigans, 43 часа назад
+14

I'll win.

На 233LCan someone tell me what's wrong?, 20 часов назад
+14
Diagnostics detected issues [cpp.clang++-c++20-diagnose]: p71.cpp:67:34: runtime error: passing zero to clz(), which is not a valid argument
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior p71.cpp:67:34 in
На prvocisloEditorial for Codeforces Round #945 (Div. 2), 14 часов назад
+14

In my opinion, leetcode is the best way to start competitive programming because it introduces the most common competitive programming concepts (greedy, binary search, dp, graphs/trees, etc etc) through more or less straightforward problems. The good thing about this is that you aren't gonna have to do some weird math things while solving leetcode dp problems, for example. You can just focus on learning dp. Another benefit of leetcode is that it has a much bigger community than cf. If you get stuck on a problem, you will have much more than just a single editorial to read. There are videos, writeups, and there is even a solutions tab that you can use to understand the problem.

If I were you, I'd go to https://neetcode.io/roadmap and just start working through that list. NeetCode, the guy who made that website, has great explanations for each problem. Once you finish that list, start doing random mediums, and when you feel comfortable with those, start trying some hards. When I was grinding out mediums, I'd try to limit myself to 45 minutes and then I'd look at the solution.

Make sure you're doing the weekly and biweekly contests while you're practicing. Once you reach a 2000+ rating, I'd say that you should start practicing on some more serious competitive programming websites. 2000 rating should get you to specialist on codeforces at least.

My clar few days ago:
Q. In scoring, "Next, we calculate the expected sum S_e as precisely as we can" Is this mean S_e is the exact sum (after converting the inputs into binary64)?
A. The intent is that it is the closest possible binary64 value to the actual (infinite precision) sum.

... then, finding the exact sum with Kahan's algorithm is contradict with this answer, but will the checker fixed?

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+13

Proud of myself by solving C with proving its validity, not by guessing

На iamdiv5You can be CM too!, 14 часов назад
+13

Solving a 1600 rated problem in your first contest is considered division 5?

any random things like selling solutions can happen. We shouldn't presume guilt, but he had already cheated.

На prvocisloCodeforces Round #945 (Div. 2), 43 часа назад
+12

TimDee has neither silver medal nor girlfriend

На waipoliEolymp Weekend Practice #2, 40 часов назад
+11

wasn't eolymp created by medv?

На NeroZein[Discussion Thread] APIO 2024, 40 часов назад
+11

First, we can make $$$4$$$ arrays $$$gr, gl, sr, sl$$$ which stores for index $$$i$$$, what's the nearest greater value to the right, to left and smaller value to left and to right. This can be done using stack in $$$O(n)$$$. Now, let's consider the edges (there is an edge between $$$(i, j)$$$ if we can go from $$$i$$$ to $$$j$$$ in $$$1$$$ move i.e all elements in between are between $$$a_i$$$, $$$a_j$$$). Important thing to notice is that, we will take the edge which brings us closest to $$$r$$$ (considering the query $$$(l, r)$$$). Also, another observation is that it is easily determinable that whether $$$a_i$$$ is a min-point or max-point. We can just check that whether $$$a_{i + 1}$$$ is less or greater than $$$a_i$$$ and then we can't have $$$a_i$$$ as min if $$$a_{i + 1}$$$ is less than it (similar for other case).

Assume that $$$a_i < a_{i + 1}$$$ since other case is similar. Now, $$$a_i$$$ is min and we want the max points. Note that the edges from $$$i$$$ are going to the changes in the max as we go towards right from $$$i$$$. Now, where will the last edge be? It will be to the maximum in the valid range. What is a valid range? the range will be valid such that the min point $$$i$$$ does not change. So, beyond $$$sr_i$$$ (the first index to the right of $$$i$$$ which have smaller value than $$$a_i$$$)we don't have any edge outgoing from $$$i$$$. So, we just get the max in the range $$$[i, sr_i)$$$. Now, we have $$$O(n)$$$ edges added in $$$O(n \space lg(n))$$$.

We can also do binary lifting and store where do I land when I take $$$2^x$$$ edges.

Now, when the query comes, we just go to the rightmost point we can from $$$l$$$ which is $$$\leq r$$$. What to do after that? We can now just do the same things we did for going in the right direction, for the left direction. Now, we starting going left from $$$r$$$ (using binary lifting). And we want the minimum jumps needed to get $$$r \leq l$$$. Now, we add both of the steps and we are done.

Proofs of the observations are not hard, I believe that you should try them.

Implementation

thanks for the great contest! i really liked problem H.

На Rezwan.Arefin01Checklist for OI Problems (WebApp), 36 часов назад
+11

It’s down now. What happened?

На moemen_proBinary Search, 35 часов назад
+11

can you do a blog edu about binary tree on segment search in O(nlog) compilation time ?

На moemen_proBinary Search, 35 часов назад
+11

sorry I meant binary search on tree segment

На moemen_proBinary Search, 27 часов назад
+11

r/wooosh

На TemirulanICPC related Bay Area meetups, 24 часа назад
+11

If I was there, I would surely ask Bill why they allow for such discrimination in ACPC. Can someone please do it for me?

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+11

As long as $$$1$$$ is not one of the chosen elements to be local maximums, then such construction will lead to values $$$\geq n+2$$$ for local maximums and $$$\leq n+1$$$ for other values.

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+11

A: I guessed we should greedily remove (1, 1) from 2 highest score until there is 0/1 positive score left.

B: I guessed it's binary searchable.

C: I guessed only considering position 2 and 3 is sufficient.

D: What should I guess? XD

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+11

Thank's! will see the hint after AC :)

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+11

Is it just me who solve A with a naive dp? Can't even come up with any solutions now xD

На MarinushAsk Me Anything!, 2 дня назад
+10

This blog became more of an orz warks profile review than AMA!

На Nummer_64IOI 2024 Teams, 46 часов назад
+10

Nummer_64 will win IOI2024!!

And PieArmy will win EJOI2024!!!!

На MarinushAsk Me Anything!, 42 часа назад
+10

When you die, would you rather not exist at all or have a 99% chance of going to heaven and a 1% chance of going to hell for eternity?

На SOUMYA_RJEfficient Range Updates Using Delta Encoding, 23 часа назад
+10

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 12 часов назад
+10

I ended up coming up with the editorial solution and another in the contest, so I'll describe them both:

Editorial Intuition We suppose $$$n$$$ has odd index and then try to make all odd elements into peaks. Is it possible? The worst case might be when $$$1, 2, 3 ... n/2-1, n$$$ are the elements in the odd positions and $$$n/2, n/2+1, ... n-1$$$ are the elements in the even positions. We can even go further and assume $$$n-1$$$ is next to $$$1$$$ and $$$2$$$, and $$$n-2$$$ next to $$$2$$$ and $$$3$$$ and so on.

Obviously let's assign smaller labels to the ones in the even position and larger labels to the ones in the odd positions. Well $$$n-1$$$ gets the label $$$1$$$, so $$$1$$$ and $$$2$$$ need the labels $$$n$$$ and $$$n-1$$$ respectively, and then continuing in this way we can make the observation that you call counter-intuitive.

My Intuition We can construct $$$q$$$ so that all the $$$a_i$$$ are equal (make $$$q_i + p_i = n+1$$$).

Now we want to reorder some elements of $$$q$$$ such that all the odd/even elements become peaks. Since all elements of $$$a_i$$$ are equal at this point, we just need to reorder the elements of $$$q$$$ so that the ones in odd indices increase, and the ones in even indices decrease (or vice versa).

There's a lot of ways to do this, the first one that came to my mind is just suppose that $$$n$$$ appears at an even index $$$2k$$$ and sort the odd indices in increasing order of value.

Then do $$$q_{o_1} \rightarrow q_{o_2} \rightarrow q_{o_3} \dots \rightarrow q_{2k} \rightarrow q_{o_1}$$$.

i.e. the smallest odd index gets value of the next larger odd index, etc. and the largest odd index gets the value of n.

+10

I hacked it with the obvious test case. You got lucky with weak system tests.

На MikeMirzayanovRule about third-party code is changing, 43 часа назад
+9

You can write contest from only one account and you can only have 1 account.

You create a vector of size 1e6 every test case. Since the number of the test cases may be up to 1e4, your code leads to TLE.

На moemen_proBinary Search, 36 часов назад
+9

interesting bro. ples publish mor content

На prvocisloCodeforces Round #945 (Div. 2), 27 часов назад
+9

So you are proud of being a troll with no life?

На Nummer_64IOI 2024 Teams, 2 дня назад
+8

As a contestant, qwerasdfzxcl is handsome

На GastQuestion???, 2 дня назад
+8

I believe priority queue is better as it uses heap instead of a balanced BST, which makes it better in terms of time complexity(better as avl rotations have higher constant factor than extract max of heap) and space complexity(no need of pointer to left and right child as would have been needed in balanced tree for set).

На galen_colinshenanigans, 47 часов назад
+8

Fuck it, it is 5:30 over here, we have to start in 3 hours and I couldn't sleep yet. I don't understand what is going on. I hope you haven't poisoned me guys.

На suleymancakirEJOI 2024 Teams, 44 часа назад
+8

Ice_man2.0 will win EJOI

На hulmSome strange things with GCC, 44 часа назад
+8

I found the problem. It was on the 48-th line, because $$$j$$$ could be negative, which led to negative indexing.

In my humble opinion, these recent announcements are not entirely fair to those individuals in top positions, as they were clever enough to unravel the hidden aspects of the contest unaided. Now, they may face additional competition for the top spots. While such adjustments might be acceptable in a 'just for fun' contest, they seem unjustified here, especially considering the significant monetary stakes involved.

Fear not, top performers! I pose no threat to you! I currently reside at the bottom of the leaderboard and intend to stay there for the duration of the competition. :)

Good luck!

На moemen_proBinary Search, 34 часа назад
+8

idk it sounds cool

На prvocisloCodeforces Round #945 (Div. 2), 20 часов назад
+8

Pretty much. You do the round before it is held and give feedback to problem authors. You can also upsolve and give suggestions and feedback to authors even after testing. Basically helping with problems as it's much easier to make good problems when you have opinion from a lot of people.

На prvocisloCodeforces Round #945 (Div. 2), 15 часов назад
+8

Why do you think so?

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 13 часов назад
+8

I think for Problem C hint 2 should be n/2-1.

prvocislo

На prvocisloCodeforces Round #945 (Div. 2), 13 часов назад
+8

A bit tougher than usual Div2, but the problems were amazing.

I felt B > C, especially proving that binary search works in B has taken a lot of time.

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 12 часов назад
+8

The fact that n is even should signal that maybe you can somehow split numbers into two groups.

Secondly, it'd fairly common to sort permutations in opposite directions (ascending/descending) and match them greedily.

Also worth noting, it's very easy to get sums of all elements of final array to be equal to (1+n), by matching $$$p_i$$$ with (1+n-$$$p_i$$$).

This was my thought process during the contest, it's really just 3 standards ideas combined together. If you write all these out at some point you'll notice that you can ensure (n+2) is reachable in n/2 points so ot suffices to make the others no greater than n+1, which like we said has an easy construction.

На prvocisloEditorial for Codeforces Round #945 (Div. 2), 12 часов назад
+8

great explanation sir : )

+8

Hey! Check out my video solutions for the contest. I've covered Problem A-D here: https://youtu.be/owawrSp2ywU