Codeforces and Polygon may be unavailable between Aug. 17, 19:00 (UTC) to Aug. 17, 22:00 (UTC) due to planned power outages. ×


Yes -- it looks like you are keeping track of what digits appear in a single current number and then picking a digit to multiply by based on what maximizes the next number.

What I am saying is that this decision of taking the largest of the results is not globally optimal.

Note that it is not always optimal to multiply by the largest digit every time.

See this comment (and maybe work it out on paper too).

Typo: I meant TLE not WA.

Sorry about that.

In my experience, it does not make a significant difference.

Perhaps it may be "optimal" but it likely won't be the difference between a TLE and AC.

Hope this helps.

Edit: Changed WA to TLE.

It seems your chess rating correlates with your CF rating :D congrats

That was the smoothest segue into self-promotion I've ever seen xD. +1

(On a more serious note that video is very educational and helped me understand RMQ) :D

Auto comment: topic has been updated by zekigurbuz (previous revision, new revision, compare).

Thank you for the idea! I will look into it.

Will do. I was meaning to learn more about treaps as well.

Thank you for the reply.

I wasn't really trying to use ordered_set to solve this problem. The reason I mentioned the problem was because it is what caused me to think about learning more about ordered_set in the first place. Thank you, though.

It turns out that I was just being dumb (not being knowledgable in C++). The reason my code was breaking was because I was doing something like this: x.find_by_order(1).first instead of this: x.find_by_order(1)->first.

Thank you for helping me realize that.

Auto comment: topic has been updated by zekigurbuz (previous revision, new revision, compare).

I definitely agree with these ideas. It is quite rough to begin CP on a website like CodeForces when your first couple rounds are a tough Div. 2 or even sometimes Div. 3. My own concerns were about the stress on the CF infrastructure, especially with the recent queue problems and outages we have experienced since Div.4 rounds will surely bring thousands of new people to CF. Overall, any growth to the CF community is welcome in my opinion, and splitting up divisions more thoughtfully has been long overdue as well.

As a participant of CF, I have observed the growth of the website during the pandemic, and think that although there are a lot of new green/grey participants that may seem to "saturate" the lower rankings of contests, I haven't observed significant rating inflation except maybe a small trend or for lower rated contestants which isn't a huge concern in my opinion.

Starting at the end, for every index, let's imagine some string such that it looks like aaaaaabb.

Now imagine the left-most b moving to the left. For each move to the left, the right-most b has one more possible location. For example, aaaaaabb has 1 position for the second b, aaaaabab has 2, and so on.

This remaining k value can also help us calculate the position of the right-most b because of the fact that it's remainder once it is less than n-i-1 hints at where it should go.

To view the hack:

Your Profile -> Submissions -> Hacked Submission -> # Button -> View Hack

Your Hacked Submission

During the contest, my intuition was thinking that not all (i,j) pairs would be possible during DP, so I included the boolean matrix as an extra precaution.

I knew that the extra space wouldn't really matter and played it safe. IDK if it makes a difference but I wasn't worried in-contest because I wanted to make sure I just got the task right.

I think your mistake is that you are keeping track of the last seen element rather than the first seen.

On Nk77Automatic Logging Out, 2 years ago

I believe that this is the first such Codeforces round. Hopefully it will be fixed by the time of the next round.

I experienced the same problem during the round, and the only thing I could do was refresh often and log back in when necessary.

I see. In that case, here are some USACO Gold problems I would recommend that aren't just greedy.

You can always look at the problemset and turn on the dp tag and sort by rating or number of solves in ascending order. I'd recommend looking around a rating of 1600-2000 for some basic (or a bit harder) dp tasks.

Alternate solution to task E:

Considering all times of the day modulo h, let dp[i][j] be the maximum number of good sleeping times assuming that Vova has slept the first i times and that the current time of day is j.

Also, let's maintain boolean array pos[i][j] such that pos[i][j] is true IFF it is possible to end up at time j after sleeping i times.

Now, transitions can be calculated by setting dp[i+1][(j+ai)%h] to max(dp[i+1][(j+ai)%h, dp[i][j] + ((j+ai)%h >= l && (j+ai)%h <= r ? 1 ; 0) and applying a similar transition for ai-1.

Now, the answer is just the max dp[i][j] such that i = n.

I noticed a comment denoting a similar solution although my submission was in-contest unlike the other comment.

As far as I know, you cannot delete your account.

Ah, thanks for the clarification

Where are you seeing two? I only see one which is the Dasha contest...

For practicing, I would recommend the following strategy:

There is a website called which shows upcoming contests. Now I wouldn't necessarily recommend that you participate in every single possible contest, but I would say that it is a good idea to look at these contests, especially those that have editorials/tutorials posted and try to work through the problems with a calm mindset. If you aren't making any progress for a while, then look at the editorial. But go off of "time that you haven't made progress", not "time you have spent on the problem"...

I find that doing virtual contests also helps a lot in practice because you can feel the slight stress of the contest environment without the full risk of your rating on the line. I would recommend CF virtual contests maybe every one or two days if you would like to see some progress quickly.

All of this in mind, practicing doesn't ensure 100% that you will see results. It may take a few months even for you to get used to the stress that comes with partaking in contests. For me, it took a while to get past the phase of "oh no, now that I'm specialist, I shouldn't do this contest. I worked so hard to get here and what if I lose 100 rating or so and become pupil again?" This isn't a healthy mindset to have because if you fear failure, you essentially fear progress as well. That is the way CF works.

Anyways, hopefully this is helpful/motivational. I wish you luck in your practices and contests!

Here is all of tourist's problemsetting: ( Some rounds are written solely or almost solely by him.