diskoteka's blog

By diskoteka, 15 months ago, translation, In English

☀ ☀ ☀ Hey Codeforces ☀ ☀ ☀

Summer is ending, but my team and I are happy to invite you to participate in Codeforces Round 894 (Div. 3). The round will take place on Aug/24/2023 17:35 (Moscow time). You will be offered 7 problems with expected difficulties to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have a rating of 1600 or higher, can register for the round unofficially.

The round will be hosted by rules of educational rounds (extended ICPC). Thus, solutions will be judged on preliminary tests during the round, and after the round, it will be a 12-hour phase of open hacks.

You will be given 7 problems and 2 hours and 15 minutes to solve them.

Note that the penalty for the wrong submission in this round is 10 minutes.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them)
  • do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Problems have been created and written by: diskoteka, pavlekn, playerr17. Ivang helped us with the idea of one of the tasks.

We would like to thank:

  1. Vladosiya for coordinating the round

  2. MikeMirzayanov for great Polygon and Codeforces platforms

  3. feeder1, Xellos for red testing

  4. michao, induk_v_tsiane, Phantom_Performer, vladmart, dmkz, LordVoIdebug, vrintle for yellow testing

  5. kzyKT, celin for purple testing

  6. segment_tea, Egorsa, MADE_IN_HEAVEN, Thost, BF_OF_Priety, mewnya, natalina, Serik2003 for blue testing

  7. i_love_penguins, tnaito, akwa_blue, Zeyad_Hekal, NgJaBach for cyan testing

  8. mkshh, myav for green testing

We wish you all good luck and a high rating!

UPD: Editorial published

  • Vote: I like it
  • +370
  • Vote: I do not like it

| Write comment?
»
15 months ago, # |
  Vote: I like it -7 Vote: I do not like it

As a tester, I really liked the problems. I wish you good luck and have a nice day!

»
15 months ago, # |
  Vote: I like it +6 Vote: I do not like it

As a participant I will participate and be pupil again: : : : :

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

do not have a point of 1900 or higher in the rating.

Should it be 1600?

  • »
    »
    15 months ago, # ^ |
      Vote: I like it -10 Vote: I do not like it

    idk why, but it was always 1900

  • »
    »
    15 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    no

  • »
    »
    15 months ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    I guess you don't understand what that part means. First, you should probably read the last paragraph of this blog.

    From the blog:

    -- We will exclude from the official standings of Div. 3 rounds and put in a separate rooms all those who can’t be reliably called to be a real participant. Accounts that materially participated in less than 2 rating rounds (materially means solved at least one problem there) before the start of the Div. 3 rounds, and those who have ever gained 1900 or more rating units will not get into the official standings and will be assigned to separate rooms. However, this does not mean that there is no rating recalculation for them. Thus, the rating will be updated for all users whose rating is strictly less than 1600 at the time of the start of a round.--

    In short, everyone who has $$$< 1600$$$ rating will receive rating change after the round, but only some of these participants will be shown in the "official standings". Namely,

    • People who have participated in less than $$$5$$$ rated contests (originally $$$2$$$ as you can see) are excluded from the official standings.
    • People who have reached $$$\ge 1900$$$ rating, and later dropped back to $$$< 1600$$$ rating are excluded from the official standings.

    These rules are in place to try to make sure that everyone in the "official standings" is actually at Div.3 skill level and not someone much better just having low rating. I think it is more fair to make this rating upper bound at $$$1900$$$ than $$$1600$$$, since reaching $$$\ge 1600$$$ rating doesn't mean you are actually that good (you could've gotten lucky).

»
15 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

As a tester, I demand my name in the blue testing list and can assure that problemset is very well balanced and no problem is a cakewalk and wish everyone good luck and recommend to read all the problems

»
15 months ago, # |
  Vote: I like it +15 Vote: I do not like it

What about Vika from your last contest

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I have the impression that the contest would take place on 8/26 (Sat.) Has it really been moved up, or did I get the date wrong?

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I hope I can reach Master AFTER this round :v

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    XD

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    hi,i'm from vietnam too.probably i'm younger than you.can i chat with you about solutions,idea and ways to deal with problem?

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      It's alright, I will provide support in my freetime. However if you want to discuss more actively, I suggest you joining Vietnamese Olympiad in Informatics (VNOI) community. At the moment, they are available on Facebook, Discord, ... There are many experts in CP so that you can ask for help

»
15 months ago, # |
  Vote: I like it -8 Vote: I do not like it

As a participant I will participate hoping to be an expert XD

»
15 months ago, # |
  Vote: I like it +3 Vote: I do not like it
»
15 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Wish to be blue !!!

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I'm really grateful for the opportunity this contest gave me to reach the blue!

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I hope to be blue after this contest.

»
15 months ago, # |
  Vote: I like it +6 Vote: I do not like it

Fingers crossed that this time around, the problems are easy to understand unlike your previous round.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Is that the girl in the blog Vika, which you mentioned in your last contest? Whoes stories were hard to decode >_<

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How is it going with Vika

»
15 months ago, # |
  Vote: I like it +21 Vote: I do not like it

No offense, but pls no Vika in this round

»
15 months ago, # |
  Vote: I like it +3 Vote: I do not like it

I am crying because of interactive problem will be in contest.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Where is it written that there will be ?

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it +2 Vote: I do not like it

      The post must've been edited for some reason, I'm also pretty sure that at first it said there was going to be an interactive problem.

»
15 months ago, # |
  Vote: I like it +13 Vote: I do not like it
Heyy you
»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hope I'll regain blue soon...

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

that's not yellow it's orange sir.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

No offense, but pls no Vika in this round.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

What does red/green/etc. testing mean? I thought, tests are the same for everybody

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hoping for great div3 contest__

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Yall will like the problems.

»
15 months ago, # |
Rev. 8   Vote: I like it -27 Vote: I do not like it

.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Did you even read the announcement?

    If your rating is less than 1600, then the round will be rated for you.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope my color will change after this round . Lets go !

  • »
    »
    15 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    It will...... .......................................... .......................................... ............................ ............................ ............................ ...................... be green hh

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Really hope to reach pupil this time!

»
15 months ago, # |
Rev. 4   Vote: I like it -33 Vote: I do not like it

:(

»
15 months ago, # |
  Vote: I like it +3 Vote: I do not like it

I can't wait, I'm so excited about Div 3

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

So many Yellow and Blue testers for a cyan, green & grey round

»
15 months ago, # |
  Vote: I like it +2 Vote: I do not like it
Hope to Solve 3 Problems
»
15 months ago, # |
  Vote: I like it +11 Vote: I do not like it

diskoteka how is your vika now ? after reading last contest's problem statements

»
15 months ago, # |
  Vote: I like it +2 Vote: I do not like it

Expert round?

»
15 months ago, # |
  Vote: I like it +1 Vote: I do not like it

35k participants

»
15 months ago, # |
Rev. 2   Vote: I like it -10 Vote: I do not like it

why 'custom invocation' not working ? (: diskoteka

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    he can't control that , even mike can't , it's not working as it is contest time and too much pressure on the judge

»
15 months ago, # |
  Vote: I like it +12 Vote: I do not like it

Good contest, enjoyed it !!

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

when it's bout div.3, diskoteka never disappoint us.

»
15 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

gg, this was my first contest and i didnt know what to expect from it. The questions were great, but my solutions aren’t(had to scour over StackOverflow for a few places...). but congratz!

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

For some reason my solution to A got all different outputs than what I got when I ran it on my PC, lost 2 hours because of that, is that normal during contests or was that some kind of bug? I switched to C#, wrote the exact same code and it got accepted...

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Your uzeli array is uninitialised so has random undefined contents on each run.

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      then why did it always work on my PC? So basically I had to set all values of that array to false?

      • »
        »
        »
        »
        15 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You got lucky I guess (different compiler / optimisation settings may produce different results). It isn't worth trying to work out why it works sometimes when you have undefined behaviour, just fix the undefined part and it'll work everywhere.

        if you declare it as bool uzeli[m]{}; instead of bool uzeli[m]; it will be default initialized (which for bools is all false).

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Having spent lots of time for E because of the third test case, that's really confuse because of the note. I got AC because of predicting the actual problem LOL.

»
15 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

what is error in this code For Problem F https://codeforces.net/contest/1862/submission/220289269

»
15 months ago, # |
  Vote: I like it +6 Vote: I do not like it

mid=(lo+hi)/2 forces

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes solved the problem D with quadratic and got WA, and I know it time to use bi-search

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      D can be solved without binary search.

      Here's my submission — 220221455

      • »
        »
        »
        »
        15 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        can you please explain you solution. thanks in advance :)

        • »
          »
          »
          »
          »
          15 months ago, # ^ |
          Rev. 2   Vote: I like it 0 Vote: I do not like it

          If you observe carefully there is a pattern in the solution — 2,3,3,4,5,4,5,6,7,5... So it is like -

          2,3

          3,4,5

          4,5,6,7

          5,6,7,8,9

          and so on

          If you solve the equation nC2=r, where r=required number of different ice creams, you will get n = (1+sqrt(1+8r))/2, so just calculate this value if it is an integer it will be your answer, and if not, then it will be the first number of the row in which your answer is present so just add the diff between r and the value for which you got the answer which you can find by simply putting it back in the formula nC2 and that will be your answer.

          Sorry if I was not clear, but the main thing is finding the pattern and the quadratic then you can solve this question.

          • »
            »
            »
            »
            »
            »
            15 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            bro but in sample test case 4 for 179 why do we need 27 , by nc2 it can be wo also right because 20 c2 is 190 more than 179

            • »
              »
              »
              »
              »
              »
              »
              15 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              In question D. it is given that exactly n type of ice-cream has to be made, not greater than that not less than that. for test case 4 answer is 27 because you need 19 unique ice-cream flavor and 8 repeating flavor. e.g. 1,1,2,2,3,3,..

              19c2 = 171.

              since you have repeated 8 flavor you can make 8 unique combinations of (1,1),(2,2) ....

            • »
              »
              »
              »
              »
              »
              »
              15 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              That’s what I thought too. I spent like half an hour tryna understand until the general announcement then got AC right away

  • »
    »
    14 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Extremely short solution without binary search: https://codeforces.net/contest/1862/submission/220208197

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I cannot get the test details in E, can you help me what wrong with my code ? This is my code

:(( I know I cannot get more rating after this contest :(

  • »
    »
    15 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Do you fully understand the statement, that's confuse. If you are, the problem is just maintaining a priority queue to keep track of the largest value, and maintain the size of queue to be less than or equal to m.

  • »
    »
    15 months ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    I think the problem is that d*i can give overflow , when you're calculating res

»
15 months ago, # |
  Vote: I like it +13 Vote: I do not like it

Thank you Geothermal for this trick while using bitset.

»
15 months ago, # |
  Vote: I like it +2 Vote: I do not like it

I don't know if problem C was actually confusing or maybe I'm dumb enough not to understand it.

»
15 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Can someone hack this F solution for the case when water and fire > 1e5? https://codeforces.net/contest/1862/submission/220284156

»
15 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

for D i noticed it's . find the nearest lowest X for X choose 2 then add n-(X choose 2) . but since it failed on the last test since it's a very big number so is my logic correct and bad implementation? Edit: ok nvm i was an idiot and made r in the binary search n not 1e9 :).

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Good problems!Thank you! And I want to know is there any brute force ways for F?I got wa using my brute force way :(

»
15 months ago, # |
  Vote: I like it -8 Vote: I do not like it

Problem D:

I used binary search on k, trying k choose 2. If I found kc2 == n, answer is k.

If such a k does not exist (for example, n = 7), I found the greatest k such that kc2 < n, and then added duplicate balls. So for 7, 4 choose 2 is 6, add 1 duplicate ball (e.g. {1, 1, 2, 3, 4}) to get 5 as the answer.

This strategy worked for test 1 but not test 2. During the contest I believed it was a binary search bug but now I wonder if this strategy is valid.

»
15 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Just got F a moment after the contest ...

»
15 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Here is my Live Screencast of solving problems [A -> F] (with commentary in HINDI).

PS: Don't judge me by my current rating :(

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice problemset. Thanks for listening to the feedback on last round and made your contests better . Loved D

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone hack my F. 220282299

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How could problem E be approached? What I observed is that we optimally must select the shortest continuous subarray starting at 0 because we will always remove -d * len(a), where a is that subarray. Then we can pick maximum $$$m$$$ positive values, but how to determine the length of that subarray? Would a priority queue work and at each index check the maximum m values + -d * i?

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You don't need the shortest continuous subarray. The answer is maximum of: for each position sum of the greatest m positive elements to the left minus the position multiplied by d. If you get more than m positive elements to the left, you just erase the minimum of the set or the priority queue and update the sum.

»
15 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

F is an interesting dp problem. Unfortunately, I was not able to solve it for the limited time.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

My F solution was Iterative dp with memory optimisation

»
15 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

lognforces

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

220296987

What is making my solution slow for G? (time limit exceeded) I would want to hear some advices on how to use sets and what to avoid to not get tle in the future.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I had a similar solution, mine was segmentation error (I believe to be memory exceeded)

»
15 months ago, # |
  Vote: I like it +9 Vote: I do not like it

Nice problemset.

»
15 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Most confusing problem "D" :) && Besides lots of announcement increases the confusion level further except clearing.. ConfusingForces

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hey Cheater, why have you inserted unnecessarily string/char etc. in your code of D.

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it +4 Vote: I do not like it

      Could you point out the unnecessary string/chars you saw in his code? If you are referring to blank lines, they don't matter anyway. Could you clarify what part of the code made you believe the person you accused a cheater is actually a cheater?

      Code for reference
      • »
        »
        »
        »
        15 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        Nvm. Very my fault for commenting without checking the problem of the solution. Thought it was this Contest's D.

        • »
          »
          »
          »
          »
          15 months ago, # ^ |
            Vote: I like it +4 Vote: I do not like it

          I am not sure if you and the accuser are the same person. But accusing someone a cheater is not something we should take lightly. Your reasoning of accusing someone cheater because you thought the code was for this contest is not only unacceptable but also unforgivable. At least check the problem ID before calling out someone a cheater. Anyway, I hope you have learnt from your mistake and would take this seriously in future.

          • »
            »
            »
            »
            »
            »
            15 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I didn't accuse him. I literally specified it in the previous version that I neither accuse nor defend.

            • »
              »
              »
              »
              »
              »
              »
              15 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              If "Hey Cheater" is not accusing someone a cheater then I don't know what does accusing means. Anyway, I am not quite sure why are you replying? Are you and ccpp same person or distant cousins?

              • »
                »
                »
                »
                »
                »
                »
                »
                15 months ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                I have no idea who he is, but I didn't say "hey cheater" in any of my comments, in the CF history of this account.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  15 months ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  My bad then, I think you should have replied in the separate thread. Cause, my question was specifically to ccpp. And I did not get any answer. Your comment confused me.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  15 months ago, # ^ |
                    Vote: I like it +3 Vote: I do not like it

                  Sorry, Actually I went to saw Sol of D in his profile (submissions) then I saw this soln. I did not realize that the soln was od another contest and presumed that he had done it to pass plagrasims. I am extremely sorry to have created this confusion.

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      i knew that grays dont have brains. i was unaware that they cant even see properly

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Extremely sorry bro, I mistakenly thought you cheated. Sorry please forgive me. Sorry Again.

    • »
      »
      »
      15 months ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it

      It's Ok bro.. Understanding the coding aspect is enough.

      That's actually not unnecessary strings/char. That's called template. We mainly use it for writing code faster in contest time, Cause you already know your coding speed will impact your contest performance

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

My solution for F is slight different from others, I binary searched on time, and got amount of fire and water. Now if any of these is greater than sum, this time works. Else, I try to fill knapsack of fire in most optimal way, (by optimal I mean, filling it in such a way that it has least remaining space possible) and check if remaining sum can be filled in water knapsack. Similarly, tried to fill water knapsack in most optimal way and check if remaining can be filled in fire knapsack.

Here is link to submission

  • »
    »
    15 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    if((sum-dp[F]<=W)||(sum-dp[W]<=F))

    You only need to check one of these. Suppose sum-dp[F] <= W is true:

    dp[F] is the sum of a subset of monsters sum - dp[F] is the sum of the remaining set of monsters

    Since sum - dp[F] <= W, we can kill the remaining set of monsters with W. In other words, sum - dp[F] <= dp[W].

    Therefore, sum - dp[W] <= dp[F] <= F and the second statement is true as well.

    The same argument applies if you want to prove the second statement implies the first.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i did the same

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hello, can someone provide a hint for problem E

Thanks :pray:.

  • »
    »
    15 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Lol i thought it was question F nvm mb

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    hint 1
    hint 2

    Have a good day!

»
15 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Video editorial for problems A&B&C&D: https://youtu.be/aEB8NXX-lxA

Thought would be useful

IN ENGLISH

»
15 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Great problems, D and F were really interesting, and E was also nice. Hope to get to expert after the rating changes :)

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

In problem F, I've seen many solutions that use this bitset idea, but I'm just lost at what it does.

Can someone explain what it's supposed to be happening here?

bitset<1000001> dp;
dp.set(0);
for (int j = 0; j < n; j++){
    dp |= dp << s[j];
}
  • »
    »
    15 months ago, # ^ |
    Rev. 2   Vote: I like it +25 Vote: I do not like it

    this is the equivalent of

    for i from 1 -> n:

    for j from sum -> a[i]:

    dp[j] |= dp[j — a[i]]

  • »
    »
    15 months ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    generates all subset sum which are possible.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it +20 Vote: I do not like it

    OK, I think I got it!

    For the interested:

    dp[amount] should be $$$1$$$ when we can form amount by summing some elements of s together, and $$$0$$$ when we cannot.

    Therefore dp should have enough size to store all possible different amounts. In this case, from $$$0$$$ to $$$10^6$$$.

    Initially dp will have all values set to $$$0$$$ (we don't know yet which values we can form), except for the $$$0$$$-th bit (we always can sum up to $$$0$$$, just choose no elements from the set).

    The line that sets the $$$0$$$-th bit to 1 is: dp.set(0).

    Then we iterate over all elements of our set. Say that our set s is {3, 2}.

    In the first iteration of the for, we know that we can form s[0] — that is, when we choose only the first element to form our sum — so we should set the s[0]-th bit of dp to $$$1$$$.

    After the first iteration, the $$$3$$$-rd (and $$$0$$$-th) bit of the bitset will be $$$1$$$:

    dp equals 00000 ... 0001001.

    In the second iteration, when considering s[1], we know that for each value we already know we can form, we can also form that value + s[1]. Since each bit already set in dp represents a value we know we can form, by left shifting each bit $$$1$$$ of dp by s[1], we get all new values we can form.

    In the example, since s[1] is $$$2$$$, by shifting all bits of dp by $$$2$$$, we have:

    dp << 2 equals 00000 ... 0100100 (now we know we can form 2 and 5).

    By using | between dp and dp << 2, we join all the values we already knew we could form and these new values we just learned we can form: dp |= dp << s[1].

    dp |= dp << 2 equals 00000 ... 0101101 (we can form 0, 2, 3 and 5).

    The same idea for s[1] is valid for any s[i] that comes after, and after the for, we know all values from $$$0$$$ to $$$10^6$$$ that can be formed, since they're set to $$$1$$$ in the bitset.

    There are probably better and shorter explanations elsewhere, but since this is a Div3, I think it means no harm putting mine here.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It's very unlikely that 1000 people will solve F during contest, I think heavy cheating is going on maybe those Unofficial Experts , CM, M.. provide these fellow cheaters the solution :(

  • »
    »
    15 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    F wasn't that hard to be honest. I needed around 30 minutes to solve it(spent 10/15 minutes on E after solving C). I immediately had the binary search plus knapsack idea. But wasn't really sure if it would pass(I was thinking about normal knapsack not the bitset one). Then I was able to reduce it to only knapsack without the binary search.

    I participated virtually though!

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      What's the t.c. of bitset idea? Is it O(sum + n)

      • »
        »
        »
        »
        15 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        O((n * 1e6) / 32 + n)

        • »
          »
          »
          »
          »
          15 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          can you explain it please.

          • »
            »
            »
            »
            »
            »
            15 months ago, # ^ |
            Rev. 2   Vote: I like it +3 Vote: I do not like it

            performing an operation bitset has a time complexity of n / 32 or n / 64 depending on your computer, but in codeforces it seems like it is 32.

            we iterate through every number, then we take the whole bitset and we perform OR operation with (bs << val), this takes O(ceil(SIZE / 32)), SIZE in this case being sum which is 1e6.

            we do this n times, which gives us the total time complexity of O(n * ceil(SIZE / 32)) or O(n * 1e6 / 32)

            • »
              »
              »
              »
              »
              »
              »
              15 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              I think you meant OR operation. Anyway, thanks for the explanation.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I was also surprised

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Python users, for Problem G anyone knows the source of this SortedList template 220199018? (huangxw, yuki_keshiki)

I was getting TLE with the PyRival implementation.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I copy the SortedList template from someone's submission in Atcoder contest,it is crazy fast,prefect to solve this problem.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

White spaces and endl seem no difference to checker. 220288316

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yeah , I never use " " , I always use "\n" and never had a problem.

    Spoiler
    • »
      »
      »
      15 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Cool! I knew that trailing spaces do not count. But never knew that new line is also fine. No more space handling from now, then.

»
15 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

Can problem E be somehow solved using binarysearch?

»
15 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Hey everyone, I'm a newbie. I want to ask why this round is not rated for me. Thanks.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I remember after hacks there is system test later.After that,it will be rated :)

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

the observation, maximum difference between adjacent elements of the array for problem G is damn cool !!

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Why are the rating changes not out yet, hacking is over right

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There is always the daunting 2-3 hour wait after system tests before rating updates. Hoping to get pupil, I’m at 1199 right now!

    • »
      »
      »
      15 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      That’s great congrats

      • »
        »
        »
        »
        15 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        And I just noticed that you’re two points away from specialist. Congrats to you too!

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

nice contest i like it , F problem is so goood

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

where is the systerm test?

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can E be done using sliding window?

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    But you need to kill all monsters, not just a subset

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope to reach pupil after this contest. Solved 4 problems

»
15 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Why don't start system test immediately ?

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Why don't start system test immediately!!!!!

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Why don't start system test immediately ?

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I am a python user but I dont know what is the alternative of multiset of C++ in python?

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I guess you can use heapq as an alternative

»
15 months ago, # |
  Vote: I like it +31 Vote: I do not like it

Good round in total, but problem A is very boring, problem D and F are a little boring, the others are interesting!

»
15 months ago, # |
Rev. 2   Vote: I like it +4 Vote: I do not like it

Now i have become expert the destroyer of division 3.

»
15 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

commented on a wrong round sorry

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Lmao I binary searched on F and created a dp table every time not realizing I could've just created a big one to start. Oops.

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Attention!

Your solution 220250441 for the problem 1862E significantly coincides with solutions wont_give_srsly/220246281, manvendrasinghshekhawat/220250441, bdyby11/220257824, pmqwerty/220262992, Swarupa/220264041, pranavkumarreddy567/220268055, DarkDreamin/220269225, nitiksharma/220269800, jvamshi36/220271912, jolly_79/220273460, Tintintani/220275635, absolute_07/220277807, jkoushik_iiitn/220278018, abhay5a/220278945, anjan_reddy/220279911, kunaltelangi/220280520, Mobbbbb/220281738, i_decided/220284890, Adityaraj834/220285184. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code).

I recently received this mail stating that I was accused of plagiarism for a problem 1862E. I didn’t know any of these people nor did I share my code with anyone or use any online ide. I am 100% sure that this violation has not happened from my end.

I have personally looked at all the other submissions and none of them match exactly with mine other than using ‘multiset’ and the problem logic. I request you to please check again MikeMirzayanov.

My Submission: 220250441

Other Submissions:

220246281 220257824 220262992 220264041 220268055 220269225 220269800 220271912 220273460 220275635 220277807 220278018 220278945 220279911 220280520 220280520 220281738 220284890 220285184

»
14 months ago, # |
  Vote: I like it 0 Vote: I do not like it

please update the problem ratings, it has been more than 20 days since the contest is finished and yet problem ratings are not updated.