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:
- Geothermal, solving the set in 35 minutes and 35 seconds
- ksun48, who solved C and D first and came back for B2
- 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:
- A1/A2:SecondThread, with diagrams from Alex Li
- B1/B2: anhkha1004
- C: Intellegent, with additional writing from SecondThread and Alex Li
- D: Intellegent, with additional writing from SecondThread and Alex Li
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:
- 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)
- 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?
- We’ll be running stress tests of our backend throughout this week to measure and ideally reproduce these failures.
- 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!









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.
Did you submit a clarification request with your source code during the contest as specified in the alert? We have already processed over 1600 of these during and after the contest.
My submission is judged in the system as accepted....it has registered the submission
Oh so your total points on the scoreboard aren't reflecting the fact that the submission went through. We have a script running to update those, but it might take several hours to complete.
ok thanks
look at the scoreboard, rank 614, shreyan ray
Yours should be updated now
Also, can you please provide metrics on how many
submission requestswere dropped per second ? Many people attached the files and when clicked onsubmitbutton, 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
Setting Round 2 on November 15th would conflict with Pacific Northwest and Southern California ICPC Regionals.
Auto comment: topic has been updated by SecondThread (previous revision, new revision, compare).
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 :) )
We'll automatically move the top entrants from Round 1 to Round 2 after we finish plagiarism reviews. All you need to do is show up for the contest on November 15th :)
I secured under 200 rank in round 1 still it shows I am not registered for round 2 ,anyone else also facing the same issue ?
SecondThread can you please help in this.
TIA
Nobody is registered for round 2 yet. You'll be automatically registered before round 2 begins.
Is the MHC scoreboard for 'Round 1' finalized? or are corrections and email responses still being processed?
And thanks for organising the contest.
for round 3 ??
Are you going to remove cheaters? There are much cheaters between 1-500 ranks.
Auto comment: topic has been updated by SecondThread (previous revision, new revision, compare).
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
You are from Antarctica so that won't affect you, don't worry.
https://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States.
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).
Thank you for your effort in facing the technical difficulties and your high-quality problems.
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.
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.
Also the problems were slightly on the easier side this round.
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.
Have seen multiple people complaining about this, one such example is just in above chats.
This seems to be large spread issue
Nice Contest
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?
Same with me, it reads
Which comes up to around 6000 participants
guys, it's clear enough if it's written there . You can compete.
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.
yeah , they don't send a reminder , and that's really bad. Anyways , good luck to you!
where it is written ? what abt T — shirts rank ?
Will be tshirts?
If you are lucky and can order it within a very short timeframe when they are available.
orz
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
agreed completely
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 ?
Why is the contest an hour late?
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.
When will the scoreboard get updated?
Not being able to see the live scoreboard is torture!!
You could still see your rank though. And the problems are ordered according to difficulty. Not sure what additional info you can get from a live scoreboard.
most probably after the contest and submissions judgement
Is it possible to solve B without Lazy Propagation?
yes ofc
I tried Binary search... but my greedy fails.
My strategy...
First create frequency map per score.
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 ).
Can you explain the checker function because i had same logic but for checker function i used priority queue
I used sorted array of candies. Tried to distribute highest quantity of candy first...
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 :)
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.
If the assignment was done for all i from k to 1 then it is possible.
Do you mind telling how?
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
I solved it using binary search... it passed validation tests, hopefully didn't miss any edge cases.
Nah can you explain your algo? mine was (log N * (N*M)) and was mostly gave TLE.
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.
Nvm, got an FST on this solution.
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).
For the given conditions, we must:
If you decide to pick (m) batches, then you must check whether you can assign points:
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 lastmscores.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?
imo B>>C
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.
For B i also used Binary search but mine checker function was un-optimized :(
For C, I did simple BFS but I removed entries from $$$L$$$ as I processed the nodes so it was amortized.
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:
I think solving the subproblem mentioned in (2) can be done with sets, but I just bashed it with a lazy segment tree.
Could you please let me know your answer for following test:
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.
My solution reports 5.
5
"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.
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$$$})
how did you do it with lazy segtrees?
is $$$O(2^k \cdot k^2 \cdot 10)$$$ not intended for D? T_T
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 :/
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.
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.
Congrats for rank 2 , Sir ^_^
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.
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:
Thanks for the round!
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.
tbh they had almost the same score so it made sense to read them both
Just wondering, do you have a link to such a problem?
JOI Spring Camp 2023 Cookies uses the exact trick apparently.
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.
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)?
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.
B testcases kinda poor
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 :(
last year my rank was around 2100 and then after plag check it was around 1900
Thanks for the hope, it's not always that I wish some people have used AI :P
you are in for a treat
Well not if they rejudge B
Rank 2040 here. I also advocate for Tasky's survival!
Edit: I dropped to 2041 :(
Edit: I raised to 2029! :)
Edit: 2014 :O
Edit: 2013 x(
Edit: 2007!!!
Edit: 2002 OMG OMG OMG
Edit: 2001 THEY ARE DELETING RIGHT NOW OH MY GOD
Guess who is placed 2000 right now 8)
Got my shirt.
Still advocating for Tasky's survival!
congats bud ^_^
Congrats!
I was at 2059 when contest ended, jumped to 2032 in a week and now at 2005. Just a few more cheaters MHC team, please orz
But also advocating for Tasky's survival — everyone who actually solved AB deserves a T-Shirt!
bruh SecondThread can you pls confirm till when the scoreboard will be freezed ? it seems till round 3 start .
1999th now! :D
It seems like they're only disqualifying cheaters but not doing anything about people who passed B with wrong solution
Yes brother, just wanted to notify you about your new placement too!
FYI, after Round 3 you went from Placement 2002 to 1998. Congrats for the shirt! Save Tasky!
An idea when they start shipping the Tees ?
Thank you so much for the positive update! Finally, even I am in top 2000 :) Save Tasky still!
Round 2 screencast
Anyone like me ? It's fucking "something went wrong again" and when I switched browser it magically resolved ?
A single moment when the scoreboard was working during the contest:
Suspicious? :D
obv :|
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
Never mind, it is getting worse TwT
Another concern, why are the certificates even generated when the ranks are not finalized yet?
For first problem, for m=1, shouldn't the answer be no for each case?
As long as no player has margin of 2 above the other, the game will not end. The scores can go (0, 1) -> (1, 1) -> (1, 2) -> (2, 2) -> ...
Ok thanks got 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.
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.
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).
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
Plagiarism checkers fear this one line:
ujjawal = "sinhaujjawal";:pWhat about this one (rank 106)? :D
The funniest thing is that most of these people, when you google them, are like 'aspiring coder pupil@codeforces' at LinkedIn.
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.
Now he is a Brit...Lol
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.
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.
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
Still, he was not removed.
From the numbering it was probably Gemini : )
Did they removed any of these cheaters?
average indian atp
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.
orz observation
Did anyone else manage to get a fail on A?
Didn't consider the case when n is odd and m < n. Passed validation, failed main test.
L pretests :cry:
+1
Just one test case 3, 2 :(
I submitted a wrong solution for B in round 2, yet it passed somehow.
It fails on
and
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
Why was D taking so long to run even for efficient solutions time complexity wise ?
I think the point was to allow only the solutions $$$dp[mask]$$$ and not $$$dp[cur][mask]$$$
Will B get rejudged?
I don't think so considering their convention for TL and submitting solutions.
what?
oj1 is saying that it's impossible to rejudge because they don't run the code so unless they come to your house and ask you to rerun your code on extra test cases they can't rejudge and i don't think they will come to your house
Don't they ask us to submit source code though ? What is the purpose of that then
Mine B would get fail if it is rejudged.So, I think they should had made stronger validation tests.
Hacker Cup validation tests are not like CF pretests.
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.
Yathish G P (Øptímîst)'s code:
suspicious suspicious suspicious behavior
SecondThread, can you look at it and ban him/her?
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.
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.
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$$$})
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$$$.
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
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$$$.
In this example that you mention, according to what's written in the editorial, wouldn't the staircase construction result in:
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.
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:
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
they selected all participants with score >= 32 which is equal to score of 5000th participant
Then why they didn't mailed us with info? I missed Round 2 just because i wasn't even aware about this
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
Same here with 549 :_
SecondThread, can you confirm whether more plagiarism checks are going to happen? There are still many cheaters present between ranks 1 and 500.
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!
I'm not sure what they are doing...
I see there are lots of cheater under 500 still not removed.
Just saw a random ranm 143.Abhipsita Das (AbhiDas) This guy used some random single dummy code for all problems and did not upload the correct solutions to be saved from getting plag.
He is a famous cheater
There has not been a single clarification from their side after Round 2 finished. But I think Round 3 is going to happen today because all the top 500 rankers have already registered for Round 3.
One of the worse management, if hackercup round 3 is still happening without removal of cheaters.
SecondThread bruh is kidnapped.
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?
Any UPD on the T-shirt ??
The t-shirts are now available to claim on the hackercup profile. The last date to order is January 31st.
India isn't among the deliverable countries ??
yes, but why?
It is now. scroll down more.
Yeah...