SecondThread's blog

By SecondThread, history, 10 months ago, In English

Hacker Cup Round 1 Recap

TLDR: Hacker Cup Round 1 is a wrap! We’ll be holding Round 2 on November 15th (instead of November 1st) to allocate sufficient time for stress testing.

Thanks to everyone who participated, and the judges hope you enjoyed the problems!

First off, congratulations to Geothermal for winning, and our top 3:

  1. Geothermal, solving the set in 35 minutes and 35 seconds
  2. ksun48, who solved C and D first and came back for B2
  3. tourist, for placing third despite solving the set 12 seconds before Geothermal

Additionally, I’d like to give a huge thanks to the people who helped make the round possible, including the authors:

And to the judges at Meta, who spent their entire weekend answering 1,600 clarification requests during and after the round to help save the contest, including especially Joyce Lynn and Wesley May (wjomlex).

What was up with the technical difficulties?

This year, we received an unprecedented number of submissions ( +88% YoY). For comparison:

Unfortunately, our underlying database simply could not keep up with this amount of traffic. This affected everything that relied on that database, from registering for the contest, to viewing the scoreboard, to making and judging submissions. Here’s our requested traffic (orange) and delivered traffic (purple):

Under normal circumstances, these lines should match perfectly.

In truth, we suspect the orange line is also likely an underestimate of the true demand for two reasons:

  1. This only reflects people who could register, load pages, and make the requests. Others likely wanted to register for the contest after it started, but couldn’t. (They would need to load the contest and write to the DB to register for it)
  2. The orange line shows unexpectedly consistent peaks. Usually we see more variation than this, especially during the beginning and end of the contest. This suggests those regions may be getting clipped because individuals face issues before getting to the place where they even need to make a submission.

What are we doing about it?

  1. We’ll be running stress tests of our backend throughout this week to measure and ideally reproduce these failures.
  2. After reproducing, we'll be improving our database structure to make sure we can handle the levels of traffic we need.

We want to make sure we execute on this well, and that will take some time and attention to get right. We’ll plan to host Round 2 on November 15th (instead of November 1st). This should give us the time we need to run these tests, and fix the underlying issues we find, without decreasing quality of the problems.

Scaling pains like this are unfortunately common, and they are especially unforgiving in cases like coding contests where all your traffic comes in one huge burst. All things considered, I'm thankful that we were able to save the round, and for the opportunity to build an even more reliable system in the future.

We hope you enjoyed the problems, our transparency, and the chance to compete in Hacker Cup, and that you are looking forward to Round 2 and a more bullet-proof platform as much as we are. We'll see you on the scoreboard on November 15th!

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

»
10 months ago, hide # |
 
Vote: I like it +25 Vote: I do not like it

Where is the part you do something about the submissions you actually received? My submission on D is an AC according to the system but not counted in my score...many others have reported same issues.

»
10 months ago, hide # |
Rev. 5  
Vote: I like it 0 Vote: I do not like it

Also, can you please provide metrics on how many submission requests were dropped per second ? Many people attached the files and when clicked on submit button, they got internal server error. and they had to select files again. It worked fine on 2nd or 3rd attempt but sadly towards the end, platform completely stopped taking submissions.

In my experience, I felt in last 2-3 minutes, website actually stopped taking submissions, I tried multiple times submitting solution for C, but the platform wouldn't accept. We were just curious, towards the end of the contest, how many submission requests were actually dropped...

I also sent mail with attaching my files ( Source code and large-output.txt) but haven't received any response yet.


You can refer to my public comment with code, right after the contest ended.


https://codeforces.me/blog/entry/146883?#comment-1318902

»
10 months ago, hide # |
 
Vote: I like it +71 Vote: I do not like it

Setting Round 2 on November 15th would conflict with Pacific Northwest and Southern California ICPC Regionals.

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

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

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

SecondThread from when can we register for round 2 , asking because we have our semester exams in that interval (and the date just does not slip from my mind :) )

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

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

»
10 months ago, hide # |
 
Vote: I like it -10 Vote: I do not like it

I highly appreciate the team's efforts in making R2 stable, but mate, why shift the start time by 1 hour? It is already too late for the eastern part of the world

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

Esteemed contest organizers SecondThread , I am writing to report an issue regarding the submission of my code for problem C. Due to a site malfunction, I was unable to submit my solution. I shared my code during the contest in the clarification section. I kindly request that you review my submission, specifically for rank 2633, Nitin Kansal (Nitzen).

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

Thank you for your effort in facing the technical difficulties and your high-quality problems.

»
10 months ago, hide # |
Rev. 2  
Vote: I like it +33 Vote: I do not like it

Just a comment to let you know there are still people love HackerCup.

I know big tech are all moving resources to AI, so I truly appreciate all on the traditional algorithms part as well.

»
10 months ago, hide # |
Rev. 2  
Vote: I like it +59 Vote: I do not like it

One reason why the submits statistic could be higher than last year could be because of the server problems. I anecdotally found that when you submitted your full output and got an error, sometimes a submission was still made and this results in people having duplicate submissions within minutes of eachother because they thought the first one failed.

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

    Also the problems were slightly on the easier side this round.

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

I got AC on A-C and then a WA on D which should result in a point total of 79, but my score is 56 (putting me lower than people who just didn't submit D). This isn't too big of a deal since my placement still qualifies me for round 2, but I do hope this gets fixed.

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

Nice Contest

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

Currently, I have a query about tomorrow's Round 2. Sadly, I couldn't place among the top 5000 contestants on Round1 but, In Round2 scoreboard, I am seeing my name and entry in the Scoreboard. Looks like there are more than 5000 people in the Scoreboard of Round 2. As my name appears to be in the scoreboard of Round2, Does that mean I can compete in tomorrow's Round?

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

    Same with me, it reads

    To advance to Round 2, you must have scored at least as many points as the rank 5000 contestant in this round.

    Which comes up to around 6000 participants

    • »
      »
      »
      10 months ago, hide # ^ |
       
      Vote: I like it +11 Vote: I do not like it

      guys, it's clear enough if it's written there . You can compete.

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

        Thank you very much for your comment. Without seeing it I'd have missed round 2 because I thought I didn't qualify for it and deactivated my FB account.

        I wish they send emails to remind participants.

        • »
          »
          »
          »
          »
          10 months ago, hide # ^ |
           
          Vote: I like it +11 Vote: I do not like it

          yeah , they don't send a reminder , and that's really bad. Anyways , good luck to you!

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

      where it is written ? what abt T — shirts rank ?

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

Will be tshirts?

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

orz

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

Why did you change the threshold to qualify for round 2?

Its always been top 5000, making it any higher would make round 1 completely pointless

A1,A2,B1 are trivial to solve in 3 hours, there should still be some stakes (like solving it not too slow)

essentially without notifying anyone, you've made almost 50% of participants quality (and more like 80% of people who actually submitted or tried), when it should have been closer to 33%, Yes I'm aware round 1 shouldn't eliminate most people, but at the same time it should be used as an elimination round

does this have to do with trying to stress test the servers? you could have done that next year for r1

I do not understand what is the point of this change, please give a reason if you can.

when there's like 14k participants in r1, adding almost 1k extra to qualify for r2 is not a small number.

TLDR: youve basically removed the entire point of r1 and today is mhc 2025 r1 atp. Good luck on mhc 2025 round 1 today guys, and by guys I mean the 3-4k people who actually keep checking on the website!!!!!

anyways rant over go downvote me now I appreciate the hate

»
10 months ago, hide # |
Rev. 2  
Vote: I like it +18 Vote: I do not like it

I just checked the scoreboard of round 1 and was surpised to see that some cheaters who were banned intially is unbanned. Is plag check gone reverse ?

»
10 months ago, hide # |
 
Vote: I like it -7 Vote: I do not like it

Why is the contest an hour late?

  • »
    »
    10 months ago, hide # ^ |
     
    Vote: I like it +12 Vote: I do not like it

    The contest still runs at the usual time of 10am PT (Pacific Time, where US west coast is). However, US Daylight Saving Time has just ended, so the time difference between PT and your timezone might differ by one hour.

»
10 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

When will the scoreboard get updated?

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

Is it possible to solve B without Lazy Propagation?

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

    yes ofc

    • »
      »
      »
      10 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it +8 Vote: I do not like it

      I tried Binary search... but my greedy fails.

      My strategy...

      First create frequency map per score.

      {
         { score : 20 , people-count : 3},
      
         { score : 15 , people-count : 1},
      
         { score : 10 , people-count : 2},
      
      }
      

      Now, I did binary search on this map-array ( reduced array from map ), saying, I am able to give candies to first K-distinct high-scorers... ( if K = 2 , means, I should give candies to score-20, and score-15 people ) .

      Tried multiple greedy approaches, but couldn't pass pretest...

      I feel, C was way easier( I solved C in 1 hour with tweak of logic ) than B ... ( I could be wrong ).

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

        Can you explain the checker function because i had same logic but for checker function i used priority queue

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

          I used sorted array of candies. Tried to distribute highest quantity of candy first...

          My checker ( FAILS :( ).
          • »
            »
            »
            »
            »
            »
            10 months ago, hide # ^ |
             
            Vote: I like it 0 Vote: I do not like it

            Mine checker function was also going (N*M) worst case.

            I was basically just subtracting the freq from the pq. till either the pq empty or needed == 0 :)

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

        I also used a max heap. Suppose we want to check if first k groups can be assigned or not. Here $$$groups[i]$$$ denotes the frequency of the i-th largest score in $$$A$$$. Calculate prefix sum of the groups array, so $$$groups[1 \dots k]$$$ will be increasing. Insert the count of all the prizes in a max heap. Now, we want to iterate from i = k to i = 1 and compare $$$groups[i]$$$ with the max in heap.

        1. If the heap is empty: not possible
        2. If the max in the heap >= groups[i]: possible for i, remove the max value from the heap as even if we may not use all the prizes of that kind, we cannot reuse it for anything else
        3. Otherwise, keep popping from the heap until the sum of the popped prize counts becomes >= groups[i]. Here more than one kind of prize is assigned. But, if the $$$sum \gt groups[i]$$$ then we can reuse the leftover items. So, insert $$$sum - groups[i]$$$ back into the heap.

        If the assignment was done for all i from k to 1 then it is possible.

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

      Do you mind telling how?

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

        Sure , the idea behind it is just sort the Ai array , now construct another array which will just store the frequency of same elements ( e.g A = [7,6,6,5,2,1] => new array will be [1,2,1,1,1] "tmp array" ) now you can only assign merchandise in decreasing order so most optimised would be , if we consider first k of them => k , k-1, k-2 ... 1 , now your job is to calculate how many of merchandise you need which can be easily done as you move over your "tmp array" , now comes the main thing you need to calculate how many merchandise you have , so for that you can just sort the b array and make sure which ever values are above k => should be taken as k only (which can be easily done using binary search) . but make sure size of B array should be >= k . so overall you only need for loop and BS

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

    I solved it using binary search... it passed validation tests, hopefully didn't miss any edge cases.

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

      Nah can you explain your algo? mine was (log N * (N*M)) and was mostly gave TLE.

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

        Ok so first let us make a frequency map of the scores of the competitors. Let a be the array such that the ith element of a denotes the number of contestants with the ith lowest score. Notice that the actual scores don't matter. Let s denote the total number of prizes

        We will find j such that all contestants having the jth highest score or higher receive a prize. The main challenge is to find such an allocation of prizes to all such contestants.

        Observation-1 Notice that it is optimal to give 1 prize to contestants having the jth highest score, 2 to the ones having (j+1) th highest score and so on.

        Let x be the number of prizes which the highest scoring contestants should receive. Let y denote the number of participants who got the highest score.

        We would like to have an array of the form [x,x,x,...y terms]. Such an arrangement would ensure that the highest scoring participants are also satisfied. Of course, you could have terms higher than x as well.

        Observation-2 Let q be the number of prizes given to all participants except the highest scoring ones. Then two conditions should hold:- i) The initial y highest values of b should each be greater than or equal to x ii) q<=s-x*y

        We just need to check these two conditions. I think they are sufficient but I don't know how to prove them rigorously.

        We just have to binary search the answer for such a j now.

        PS Maybe one way to think is that in the first glance, it may seem that condition 2 is sufficient, but we find a counterexample when a single type has a lot of units. Hence the first condition is also required.

        Apologies for the bad formatting though.

  • »
    »
    10 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    1. Assume you already know that if you give some points to index (I), then all values from (I) to (N) will have scores (the whole suffix; scores are sorted here).

    2. For the given conditions, we must:

    • give the same points to all (J) where ($$$\text{score}[I] = \text{score}[J])$$$,
    • give more points than (I) to all (J) where ($$$\text{score}[J] \gt \text{score}[I]$$$).
    1. Therefore, we group indices into batches (equal scores go into the same batch). We then check how many batches of the suffix we can pick for the given total sum.

    If you decide to pick (m) batches, then you must check whether you can assign points:

    • batch (m) → position (N)
    • batch (m-1) → position (N-1)
    • batch (1) → position (N-m+1)

    The required sum is

    $$$[ \sum_{i=0}^{m-1} (N-i)(m-i) ]$$$

    This must be the sum of $$$(b_i)$$$ over the last (m) batches.

    Finally, the answer is simply the total freq[score[i]] in those last m scores.

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

How to solve B and C :)

The best I could think of B was lo (log N * (N*M)).

And C BFS

Am i dumb, B was easy?

  • »
    »
    10 months ago, hide # ^ |
     
    Vote: I like it +8 Vote: I do not like it

    imo B>>C

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

    For part B, I used a binary search algorithm to determine whether the merchandise could be distributed.

    For part C, I applied a DSU. For each node, I find the leftmost available node that can be reached within fewer than k steps by querying the DSU.

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

      For B i also used Binary search but mine checker function was un-optimized :(

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

      For C, I did simple BFS but I removed entries from $$$L$$$ as I processed the nodes so it was amortized.

  • »
    »
    10 months ago, hide # ^ |
     
    Vote: I like it +9 Vote: I do not like it

    Solution for B:

    Let's binary search for the lowest possible score $$$x$$$ of someone who gets a reward.

    How to check if an assignment exists for a certain $$$x$$$?

    Let's reduce the original set of people to a sorted set of pairs $$$V$$$, with a pair of the form $$$(s, c)$$$ indicating that there were $$$c$$$ people with score $$$s$$$ in the original set ($$$s \geq x$$$).

    It's easy to see that it's optimal to assign exactly $$$i$$$ units to each one of the $$$c_i$$$ people with score $$$s_i$$$ (assuming $$$V$$$ is sorted).

    We can then show that the following greedy is optimal:

    1. We assign units to people in decreasing order of their score.
    2. When assigning some $$$i$$$ units to a person, we always take one unit from each of the $$$i$$$ types with the greatest number of remaining units.

    I think solving the subproblem mentioned in (2) can be done with sets, but I just bashed it with a lazy segment tree.

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

      Could you please let me know your answer for following test:

      10 5
      0 0 0 0 0 1 1 1 2 2
      9 9 0 0 0
      

      Solution which I submit after contest returns 10 but I expect correct answer as 5 as possible only assign at most 1 unit of the same type.

    • »
      »
      »
      10 months ago, hide # ^ |
      Rev. 3  
      Vote: I like it +11 Vote: I do not like it

      "When assigning some i units to a person, we always take one unit from each of the i types with the greatest number of remaining units."

      How do you know which types have the greatest number of remaining units, don't you need to "re-sort" after each range update? I thought about that and got stuck there.

      • »
        »
        »
        »
        10 months ago, hide # ^ |
         
        Vote: I like it +5 Vote: I do not like it

        You can simply maintain the prefix sum of the frequency array of $$$B$$$, and store the prefix sum with a multiset, which will be helpful for doing range updates.

        E.g. if $$$B = [1, 1, 2, 2, 2, 3, 4, 4]$$$, we have frequency array (starting at $$$0$$$), $$$freq = [0, 2, 3, 1, 2]$$$ (i.e. $$$freq[i] = $$$ count of $$$i$$$ in $$$B$$$). Now, let's store the prefix sum of $$$freq$$$ into a multiset called $$$ps$$$, i.e. $$$ps = $$$ {$$$0, 2, 5, 6, 8$$$}.

        Notice that in most cases, performing "range -1" opeartions on the largest $$$k$$$ elements in $$$B$$$ is just as simple as deleting an element in our prefix sum multiset $$$ps$$$.

        E.g. Let $$$k=3$$$, then, doing "range -1" the $$$k$$$ largest elements in $$$B$$$ would be changing $$$3, 4, 4$$$ into $$$2, 3, 3$$$, making $$$B = [1, 1, 2, 2, 2, 2, 3, 3]$$$, and $$$freq = [0, 2, 4, 2, 0]$$$. Now, our updated $$$ps$$$ should be {$$$0, 2, 6, 8$$$}, which is just removing $$$5$$$ from our previous $$$ps$$$!

        Determining wether there are $$$\geq{k}$$$ positive integers in $$$B$$$ at each step is easy too! Since *prev(ps.end()) would be how many elements in $$$B$$$, and *(ps.begin()) refers to how many zeros are there in $$$B$$$ right now.

        There is also a case where $$$k$$$ doesn't cover a full block of numbers, like when $$$k=5$$$, we are changing $$$B = [1, 1, 2, 2, 2, 3, 4, 4]$$$ into $$$[1, 1, 2, 1, 1, 2, 3, 3]$$$, making $$$freq = [0, 4, 2, 2]$$$ and $$$ps = $$$ {$$$0, 4, 6, 8$$$}, which is just an additional step of changing $$$2$$$ to $$$4$$$ first, before going back to our previous case of simply deleting $$$5$$$. (i.e. {$$$0, 2, 5, 6, 8$$$} $$$\rightarrow$$$ {$$$0, 4, 5, 6, 8$$$} $$$\rightarrow$$$ {$$$0, 4, 6, 8$$$})

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

      how did you do it with lazy segtrees?

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

is $$$O(2^k \cdot k^2 \cdot 10)$$$ not intended for D? T_T

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

    Surely it is not intended, but my solution with exactly your complexity was able to get answers to all testcases 10 seconds after the timer has expired :/

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

      It is worth saying that I splitted input file with 80 testcases into 2 files with 40 testcases each and ran my solution simultaneously on 2 machines with 16 threads on each and then concatenated outputs :D

      And my exact complexity is $$$O(2^{k-2} \cdot k^2 \cdot 10)$$$ since to store pairs {mask, sum} we don't need info about 0th bit in our mask and sum-th bit — they are always equal to 1.

      I hope these 10 seconds won't make the difference because right now I'm 480th out of top 500 needed for the Round 3.

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

    Isn't that so slow that even one test would work more than 6 mins? My $$$O(2^k \cdot 10)$$$ works just below 3 sec on maxtest and around 4 mins on full set.

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

      Congrats for rank 2 , Sir ^_^

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

      My solution is $$$O(\sum_K 2^K \cdot K^2 \cdot 10 + T \cdot K \cdot 10)$$$ and with some multithreading it works in 20 seconds (my CPU is a Ryzen 9 7900). The way to make it work is just reuse the same dp for all tests with same K.

  • »
    »
    10 months ago, hide # ^ |
     
    Vote: I like it +61 Vote: I do not like it

    I had $$$O(2^k * 10 * 2^2)$$$, which took about 4m on my (fairly strong) PC.

    I pretty strongly dislike the problem with its current constraints. There are definitely some things you can do to speed this up (e.g. formulating the solution in a way that lets you solve all test cases for a fixed $$$K$$$ at once), but it's pretty sad that it's substantially easier to get AC on this problem with a strong computer than it would be with a PC 50% as fast as mine.

    My (potentially unpopular?) opinion is that MHC is not a good place for problems where a substantial part of the difficulty comes from optimizing a factor of ~20-30 or less (e.g. going from $$$2^N \cdot N$$$ to $$$2^N$$$ or $$$N \sqrt{N}$$$ to $$$N \log^2 N$$$, maybe even $$$N \sqrt{N}$$$ to $$$N \log N$$$). It's extremely hard to set such problems in the MHC format in a way that doesn't advantage people with stronger PCs, encourage making guesses about how strong the test set will be, etc.

    Some thoughts on the rest of the set, while I'm here:

    • A: fine easy problem
    • B: fine, but apparently pretty standard (others have reported that approximately equivalent problems exist on LeetCode).
    • C: pretty good problem, though I'm surprised by the score distribution. I found it easier than B; I think I struggled more with B than average, but I do think that more objectively, its difficulty is much closer to B than to D/E. (I haven't looked much at the overall scoreboard, but I had more friends solve C than B, which is consistent with the claim that C is at least not much harder than B.)
    • E: A bit on the standard side--the main observation (that we only need to find the optimal values with up to $$$N^2$$$ blocks, since beyond that we should just use whichever prefix is most efficient) is pretty well-known, and there's not much to the problem beyond that.

    Thanks for the round!

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

      My (potentially popular) opinion about MHC is that they shouldn't host contests until their servers are able to bear the load of merely displaying the scoreboard. I wasted all my time solving D because there was no way to see that E had far more solves.

    • »
      »
      »
      10 months ago, hide # ^ |
       
      Vote: I like it +21 Vote: I do not like it

      B: fine, but apparently pretty standard (others have reported that approximately equivalent problems exist on LeetCode).

      Just wondering, do you have a link to such a problem?

  • »
    »
    10 months ago, hide # ^ |
    Rev. 3  
    Vote: I like it +5 Vote: I do not like it

    If your dp state is dp[digits left][mask of current used prefix sums][current prefix sum], notice that you can always rotate the mask such that the current prefix sum is 0, so you don't need to store the current prefix sum in a state. You also don't need to store the 0-th bit of the mask then(because it's always 1), so the size of the array is $$$2^{24} \cdot 25$$$ which is small enough and it works in about 10 seconds for me.

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

      storing digits left isn't necessary, we can just look at the number of bits in mask

      but where's the parameter in dp whether the current prefix/suffix is smaller/equal/larger than $$$r$$$? And 10 seconds * 80 tests = 800 seconds which is more than 6 minutes? Or do all tests work in 10 seconds? If yes, then how is this solution so fast? Can you calculate dp only once for all testcases (with equal k)?

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

        In case it wasn't clear, dp[i][mask]=number of ways to add i more digits at the end with the current mask of prefix sums(rotated such that the current one is the 0th bit, and also not included in the actual variable), i has nothing to do with number of bits in mask(other than that their sum is <=k)

        You don't need any other parameters, for each k you only calculate the dp once, then for all i in 1..length(r)-1 you add dp[i][0] to the answer, and you can also easily keep track of the current prefix sums used and how many more digits you have to add and add the corresponding precomputed dp state to the answer when going through the digits of r one by one.

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

B testcases kinda poor

»
10 months ago, hide # |
 
Vote: I like it +42 Vote: I do not like it

There are 2101 participants with >= 20 points, so if you give t-shirts to top 2000, the rest 101 would be very upset thereby resulting in termination of Tasky. Please save Tasky by modifying the number of t-shirts awarded :(

PS: Rank 2083 :(

»
10 months ago, hide # |
 
Vote: I like it +22 Vote: I do not like it
»
10 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Anyone like me ? It's fucking "something went wrong again" and when I switched browser it magically resolved ?

»
10 months ago, hide # |
 
Vote: I like it +80 Vote: I do not like it

A single moment when the scoreboard was working during the contest:

Suspicious? :D

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

Wow, instant results. Is this the final one, except for plagiarism checks? Indirectly asking if my final rank will only improve from what I have currently.

Sad that I spent the last half of the contest solving D with wrong assumptions. Happy that I made it even after my computer broke down right as I generated the password for A :p

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

For first problem, for m=1, shouldn't the answer be no for each case?

»
10 months ago, hide # |
 
Vote: I like it +26 Vote: I do not like it

ChatGPT 5.1 thinking C solution (Shashwati Tidke from AI track has almost exactly the same):

https://chatgpt.com/share/6918eb90-b5c4-8000-a17e-23fa3f1f8428

Sadly, seems like there is some bug in the scoreboard and "Human Track + India/Pakistan" category was an AI contest as well.

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

    This is actually hilarious; I've just taken a look at per-country standings, and among the first 500 contestants, 187 do come from India. As a comparison, I did a quick lookup -- previous Div1 + Div2 rounds did not have more then 10 such contestants. Pretty insane.

    • »
      »
      »
      10 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it +23 Vote: I do not like it

      He was Indian 20 minutes ago. Looks like now he changed his allegiance to Afghanistan to escape attention. For comparison, his rank was around 1000 in the round 1 (that too cheated).

      • »
        »
        »
        »
        10 months ago, hide # ^ |
         
        Vote: I like it +22 Vote: I do not like it

        I took some time looking at some of the codes, especially the ones that are ~1000 rated on CodeForces and have a stellar performance here; it's blatantly obvious which ones are definitely LLM-generated and which ones are not.

        Just a random example from a top200 code:

        Given the speed of the solution, I'd bet that this is LLM-generated as well; would like to see the prompt used though :D

        • »
          »
          »
          »
          »
          10 months ago, hide # ^ |
           
          Vote: I like it +49 Vote: I do not like it

          Plagiarism checkers fear this one line: ujjawal = "sinhaujjawal"; :p

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

          LLMs (mostly Gemini and ChatGPT) are giving correct solution for A and B. I know some of my friends cheated by just fitting the LLMs' solution into their 200 lines template. I am afraid that they won't be removed from the ranking.

      • »
        »
        »
        »
        10 months ago, hide # ^ |
         
        Vote: I like it +9 Vote: I do not like it

        Now he is a Brit...Lol

    • »
      »
      »
      10 months ago, hide # ^ |
       
      Vote: I like it +50 Vote: I do not like it

      187 out of 500 is enormous. Considering that not everyone has their country listed, it’s actually around 187 out of roughly 350, by my estimate, which is even worse.

      • »
        »
        »
        »
        10 months ago, hide # ^ |
         
        Vote: I like it +45 Vote: I do not like it

        Yup, not sure if anyone from Meta is going to take action (I think they will, but let's see), but actually having ~200 imposters in the 500-people R3 sounds pretty extreme.

        • »
          »
          »
          »
          »
          10 months ago, hide # ^ |
           
          Vote: I like it +9 Vote: I do not like it

          The guy that got 27th on round 1, Navjeet Bharti, obviously used chatgpt. He didn't even try to hide it. Like look at his solution on problem C on round 1

          // Function to solve a single test case
          long long solve() {
              int N;
              std::cin >> N;
              std::vector<int> A(N);
              for (int i = 0; i < N; ++i) {
                  std::cin >> A[i];
              }
          
              // Use long long for all calculations to prevent overflow
              long long n_ll = N;
          
              // 1. Calculate S_total_len
              long long s_total_len = n_ll * (n_ll + 1) * (n_ll + 2) / 6;
          
              // 2. Calculate prefix XOR array PX
              std::vector<int> PX(N + 1);
              PX[0] = 0;
              for (int i = 0; i < N; ++i) {
                  PX[i + 1] = PX[i] ^ A[i];
              }
          
              // 3. Build frequency map
              // We use long long for the count (p)
              std::unordered_map<int, long long> counts;
              for (int val: PX) {
                  counts[val]++;
              }
          
              // 4. Calculate S_adjust
              long long s_adjust = 0;
              for (auto const &[value, p]: counts) {
                  // p is the frequency. Add p*(p-1)*(p+1)/6
                  s_adjust += p * (p - 1) * (p + 1) / 6;
              }
          
              // 5. Final answer
              return s_total_len - s_adjust;
          }
          

          Still, he was not removed.

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

          Did they removed any of these cheaters?

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

    average indian atp

»
10 months ago, hide # |
 
Vote: I like it +48 Vote: I do not like it

I wonder why there is no seperate post for round2 by secondthread. Then, I checked secondthread's total blog posts count and I got my answer.

»
10 months ago, hide # |
 
Vote: I like it +41 Vote: I do not like it

Did anyone else manage to get a fail on A?

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

I submitted a wrong solution for B in round 2, yet it passed somehow.

function<bool(ll)> check = [&] (ll x){
        if(x>m)return false;
        ll ndis = 0,need =0;
        f(i,0,x){
            ndis+=cnt[i];
            need+=cnt[i]*(x-i);
        }
        f(i,0,m){
            need-=min(ndis,b[i]);
        }
        if(need<=0)return true;
        return false;
    };

It fails on

1
3 3
1 2 3
3 3 0

and

1
5 5
1 2 3 4 5
5 5 5 1 1
»
10 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

The efforts described in this post clearly paid off — thanks for the smooth (infra wise) round! For people crying for unavailable scoreboard — without problem's solve count it's anyways a waste of time to scroll numerous pages with results while trying to adjust difficulty expectation mid-round IMHO.

On the dark side, it's really disappointing to hear about weak tests on B. Hopefully you'll address that properly

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

Why was D taking so long to run even for efficient solutions time complexity wise ?

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

Will B get rejudged?

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

    I don't think so considering their convention for TL and submitting solutions.

  • »
    »
    10 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it -9 Vote: I do not like it

    Mine B would get fail if it is rejudged.So, I think they should had made stronger validation tests.

    • »
      »
      »
      10 months ago, hide # ^ |
       
      Vote: I like it +13 Vote: I do not like it

      Hacker Cup validation tests are not like CF pretests.

      This step can help you verify that your solution has no obvious errors (such as incorrect output formatting).

      I do agree that it is a bit cruel for a contest with a short submission time window. Stress testing is the obvious solution that participants can use on their own.

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

Yathish G P (Øptímîst)'s code:

suspicious suspicious suspicious behavior

»
10 months ago, hide # |
 
Vote: I like it +65 Vote: I do not like it

Is the official solution for B possibly incorrect? Is that why so many wrong solutions are passing the tests? I implemented basically what it said, but could not even pass validation tests (it gives 14106 on the last case, which is too low).

All I can see in there that might be different from my sol is the line "If the deficit can be made up after summing up all remaining items..." which sounds like the remainder can be "reused" arbitrarily instead of only on the next level, which some commenters here seem to have in their solutions, but that seems to be wrong because it can't guarantee no overlap with previous instances (leading to the reports of tests which many AC solutions fail).

Only the "pick the set of prizes as the most common prizes for each contestant starting from the highest-scoring to the lowest-scoring and use a segment tree with some fancy lazy prop to ensure sorted" makes sense to me. But I checked many many sols and none of them do that?

Some of these set solutions seem to be correct too. There are also some solutions based on the suffix sums of the prize counts relative to the current number of contestants and somehow the Gale-Ryser theorem? I don't understand them though. Maybe I'm washed.

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

    The Gale-Ryser theorem means there exists a binary matrix where 1 = an assignment.

    Since it's a binary matrix, 1 winner can't have more than 1 item in each type.

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

    I can explain how to solve B using sets.

    You can simply maintain the prefix sum of the frequency array of $$$B$$$, and store the prefix sum with a multiset, which will be helpful for doing range updates.

    E.g. if $$$B = [1, 1, 2, 2, 2, 3, 4, 4]$$$, we have frequency array (starting at $$$0$$$), $$$freq = [0, 2, 3, 1, 2]$$$ (i.e. $$$freq[i] = $$$ count of $$$i$$$ in $$$B$$$). Now, let's store the prefix sum of $$$freq$$$ into a multiset called $$$ps$$$, i.e. $$$ps = $$$ {$$$0, 2, 5, 6, 8$$$}.

    Notice that in most cases, performing "range minus one" opeartions on the $$$k$$$ largest elements in $$$B$$$ is just as simple as deleting an element in our prefix sum multiset $$$ps$$$.

    E.g. Let $$$k=3$$$, then, doing "range minus one" on the $$$k$$$ largest elements in $$$B$$$ would be changing $$$3, 4, 4$$$ into $$$2, 3, 3$$$, making $$$B = [1, 1, 2, 2, 2, 2, 3, 3]$$$, and $$$freq = [0, 2, 4, 2, 0]$$$. Now, our updated $$$ps$$$ should be {$$$0, 2, 6, 8$$$}, which is just removing $$$5$$$ from our previous $$$ps$$$!

    Determining wether there are $$$\geq{k}$$$ positive integers in $$$B$$$ at each step is easy too! Since *prev(ps.end()) would be how many elements in $$$B$$$, and *(ps.begin()) refers to how many zeros are there in $$$B$$$ right now.

    There is also a case where $$$k$$$ doesn't cover a full block of numbers, like when $$$k=5$$$, we are changing $$$B = [1, 1, 2, 2, 2, 3, 4, 4]$$$ into $$$[1, 1, 2, 1, 1, 2, 3, 3]$$$, making $$$freq = [0, 4, 2, 2]$$$ and $$$ps = $$$ {$$$0, 4, 6, 8$$$}, which is just an additional step of changing $$$2$$$ to $$$4$$$ first, before going back to our previous case of simply deleting $$$5$$$.
    (i.e. {$$$0, 2, 5, 6, 8$$$} $$$\rightarrow$$$ {$$$0, 4, 5, 6, 8$$$} $$$\rightarrow$$$ {$$$0, 4, 6, 8$$$})

  • »
    »
    10 months ago, hide # ^ |
    Rev. 5  
    Vote: I like it +25 Vote: I do not like it

    I took a look at the official solution code for B and it looks equivalent to the Gale-Ryser Theorem. That is, to check whether it is possible to assign ball types with frequencies $$$a_1,a_2,\dots ,a_N$$$ to bins of sizes $$$b_1\ge b_2 \ge \dots \ge b_M$$$, it suffices to check whether $$$\sum a_i\le \sum \min (a_i, k) +\sum b_{k+1\dots M}$$$ for all $$$0\le k\le M$$$.

    which sounds like the remainder can be "reused" arbitrarily instead of only on the next level,

    The editorial explanation allows using the largest $$$k$$$ bins on up to the first $$$k$$$ levels. This doesn't actually produce a valid construction. For example, when $$$a=[1,1,2,2]$$$ and $$$b=[3,3]$$$ it seems to produce the staircase construction

      22
    1112
    

    which is not actually valid since the last bin gets the same ball type more than once. However, the check for whether a valid construction exists is correct (a construction does exist in this case).


    Note: One way to prove the Gale-Ryser Theorem is to consider what a minimum cut could possibly look like in the corresponding bipartite matching problem. There shouldn't exist any minimum cut with value less than simply cutting the edges corresponding to all $$$a_i$$$.

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

      In this example that you mention, according to what's written in the editorial, wouldn't the staircase construction result in:

        22
      2111
      

      which is a correct construction?

      The editorial doesn't mention it explicitly but what I understand from the figure shown in the editorial is that we take the most abundant ball type and start filling from the bottom right of the staircase (i.e. people with the highest score) and move horizontally leftwards, then once done with this row we move upwards and again move from right to left.

      • »
        »
        »
        »
        10 months ago, hide # ^ |
         
        Vote: I like it +8 Vote: I do not like it

        Oh I was assuming bottom left, but I don't think filling from the bottom right works either.

        $$$a=[2,2,2,2,4,4], b=[4,4,4,4]$$$

        then you get this staircase:

            44
            44
        333322
        221111
        
»
10 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Did they selected 5972 Participants in round 2 from round 1 because the number was only 5000 but there were 5972 participants in round 2. I was around 5500 so i knew i am not selected but on my certificate it shows you are progressing to round 2.

SecondThread

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

    they selected all participants with score >= 32 which is equal to score of 5000th participant

    • »
      »
      »
      10 months ago, hide # ^ |
       
      Vote: I like it +8 Vote: I do not like it

      Then why they didn't mailed us with info? I missed Round 2 just because i wasn't even aware about this

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

Round 3 is coming up, do we know who will be eligible to participate?

The contest page mentions that 5000 participants would advance to Round 2 and 500 to Round 3. Since more than 5000 participants were registered for Round 2, can we expect something similar for Round 3? (i.e., more than 500 advancing)?

Kindly asking from rank 527 :p

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

SecondThread, can you confirm whether more plagiarism checks are going to happen? There are still many cheaters present between ranks 1 and 500.

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

Is the round happening tomorrow at all?

My rank was 509 yesterday and 505 a couple of hours ago, so the changes are still being made -- can you please clarify on this so we know if we should allocate the time to do it or not?

Thanks!

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

Given that Round 2 problem B had many wrong solutions accepted, doesn't it make sense to allow both top-500 with and without it to qualify into the Round 3?

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

Any UPD on the T-shirt ??