Meta Hacker Cup 2024
Meta Hacker Cup is back! We’re excited to announce our schedule for our 2024 season, kicking off on September 20th!
- Practice Round: Fri. September 20th, 10am Pacific (72 hours)*
- Round 1: Sat. October 5th, 10am Pacific (3 hours)
- Round 2: Sat. October 19th, 10am Pacific (3 hours)
- Round 3: Sat. November 2nd, 10am Pacific (3 hours)
- Finals: Sat. December 7th, 6am Pacific (4 hours)
*While optional, we recommend you participate in the Practice Round to familiarize yourself with our submission system before Round 1, when time will be at a premium.
The contest will be held on the Meta Hacker Cup site. Registration will open July 24th.
You can expect familiar prizes in the human track, including T-Shirts, Elite T-Shirts, and cash prizes for finalists. We’ll announce more prize details closer to Round 2.
Introducing the Meta Hacker Cup AI Track
For the first time this year, we'll also be running an AI track. In it, instead of solving problems manually, contestants will create an autonomous code generation system before the start of the contest. Each contestant can compete either in the human track or the AI track, but not both.
We hope this will create an interesting benchmark for how well state-of-the-art machines are able to perform against the best programmers in the world on complex programming tasks. If you're interested in competing in the AI track, you can join our discord server to learn more.
================================
Update: Round 1 is now complete. We had a flood of submissions during the last few minutes during which everyone refreshed the scoreboard and we appear to have exceeded our number of allotted DB connections. We're looking at resolving the issue now.
Update 2: Looks like we only had a small handful of people hit the limit. Connections all have recovered.
Yayyy... Finally it's happening! Another chance for a T-Shirt!!
give me your t-shirt. xD
2023 season?
Nice catch, thanks!
It's happening!! Super excited!
yay , super excited !!!!
how hard to be ranked in 2000 in Meta Hacker Cup compare to Div1+2 round in cf?
I'm genuinely curious
same question here lol
I guess around 4-5 question in div 1+2
Yayy.... it's happening!!! very excited to participate for the first time.
why doesnt hacker cup use simple testing like codeforces does. i had a really hard time last season
Counting down the days to Meta Hacker Cup 2024. Long live Hacker Cup!
Too bad Codeforces doesn't have "haha" react
Because the ai submissions will fall on their face?
Good luck to you @Swistakk . Last time you missed final round by just 44 seconds. This time, I am rooting for you to reach Final <3 .
Thank you! Recalling that I was so close last year actually gives me some hope xD
nice, i am excited! i hope ill get t-shirt :)
Same thing every year. Make promises to change submission format at the end of the year, and keep it same the next year :clown:
Real sad Google stopped organizing. They were the only ones who did annual programming contests right.
https://codeforces.net/blog/entry/119880?#comment-1063469
Where did they promise?
Maybe 'promise' wasn't the right word, but I've been here long enough to recall SecondThread talking about updating the format. Even the comment you linked says they are looking into it. It used to be a fine format when there were so many annual contests, and it diversified the submission formats a bit. Now, I think it may be time to consider updating it for real. The only reason I can think of for not doing so is that they actually haven't put in any effort. Anyway, good luck everyone, may the stack limit be with you.
Perhaps they looked into it, decided it wasn't right for whatever reason, and moved on. Why do people want to make contests as same and boring as possible?
By boring you're talking about a submission format that reduces stress for participants? I'm sure it even reduces stress for them cos they won't have to answer hundreds of clarifications.
Or maybe get an actual IDE? Cause I bet that all of the top coders have their own IDEs which can compile the large testcase in literally ≤ 1 min.
I fail to see how an IDE helps here
well the only reason it's stressful would be if you test and your compiler can't process the testcase. And that can be solved using an IDE with the proper configurations. Otherwise the time limit is definitely sufficient.
How does a compiler process a testcase? You should read about IDEs, text editors, and compilers to understand their functions. You're mixing stuff up. Even if you're using the fastest IDE (whatever that is) how fast the program executes is still dependent on your computer specs.
Alright, then what's your problem with the current format? If you are able to compile a program on your own computer, download an arbitrarily large file, run your program with that input file and then upload the output — then you're all set to compete in the tournament.
nvm
I wanted to point out that the date of the finals coincides with the date of the Putnam collegiate math competition. It is not uncommon for people who are interested in competitive programming to also take part in such math competitions. Perhaps this could be looked at.
Sir, is the submission system same like last time? If yes, please change it to like some online judges or like codeforces.
and
Why are we not allowing a contestant participate in both the human track and the AI track?
Does it even matter? Nobody is going to choose the AI path anyways (I have only 3 candidates in mind and they are all companies)
Maybe because the problem statements are same?
Yep, this is why
How will the T-Shirt be looking this year
why dont u post youtube streams nowadays
love your channel
Instead of having a timer for test data download, will AI participants have a timer for problem statement download? :pepesmug:
Yep. And your timer will start when the contest starts. So it’ll be like a 6 minute contest basically.
Finally!!
Is the judge system same as before like locally running and submit results?
Yes
Hi everyone. I have a question: Will they deliver T-shirts to Ukraine?
Hi! The T-shirts are delivered by FedEx
If our delivery partners ship to your region, then we will. I recall last year Ukraine was one of the regions that FedEx didn't ship to. I'm not sure if this has changed since then.
Yes yes yes yes let's goooooooo
letss gooo
LETS GO HACKER CUP IS BACK!!!
is it happening?
Is the only on-site round is the last? I also wanna know what is the difference between the AI and human versions?
The difference is written in the blog
Excited
What is the last date of registration?
as its written, today is the day when registration starts, but its showing page is unavailable.
If you weren't signed into facebook before, we were accidentally preventing you from seeing the page before because your age verification was failing. It's fixed now.
Why does the page show unavailable? The registration starts today right?
It should be available now; please try again.
Was there always an age limit?
Yes, it is and has been in our terms of service
didn't seemed to be a problem last year.
How comprehensive will the test cases be (if there will be any)? From what I have seen, test cases tend to make or break the solution search strategy in attempts at autonomous code generation like AlphaCode, for example.
Do you mean in the full data? We'll endeavor to make them comprehensive as we usually do, but there's always the general possibility that there's some weird edge case that a solution we didn't consider fails. You can see examples of the kinds of test cases you can expect in the previous years' data.
Is anyone facing problem in signing up for Facebook?
yeah me
Will the finals be online?
Yes
In the human track rules, unless I missed something, it is not prohibited to use directly AI, or something like in the AtCoder wording ("It is prohibited to directly input all or part of the information issued as problems into software"). Not sure it would be useful (yet...), but anyway does that mean it might be allowed?
Oh TIL https://atcoder.jp/posts/1247
I have signed up. Can I change the size of my T-shirt ? If yes how ?
You’ll enter your shirt size when it’s about to be shipped to you later in the contest season
Why is it so hard to create a new Facebook account?
After uploading a verification photograph, an appeal is automatically sent, and my account is disabled for no reason whatsoever within the next 24 hours.
can someone tell where can I practice past problems and submit them?
Here, you can select any of the past seasons, and any of the rounds and participate. You do have to be logged in to submit though.
Hi, what is the minimum age requirement?
18 years old
any rationale for this, or any chance this could be changed?
There's lots of scrutiny about showing the names of minors who competed on a publicly available scoreboard, and Meta didn't want to open themselves up to needing to defend doing so either in court or in public opinion. For what it's worth, this has always been in our Terms of Service.
Thanks for the clarification! I guess I've never read the ToS carefully enough in the past.
So it's ok for minors to have a Facebook account and be shown to the world but it's not ok to appear on a competition scoreboard?
You can tweak privacy settings when you create an account. You can’t with a leaderboard.
But you can't hide your name
You literally can
I didn't know that. But still meta can add option to hide name from standings
I guess they could fair enough
What's the difference between human and ai track?
In the human track, you write code to solve the problems yourself.
In the AI track, you write a code generation system before the contest to solve the problems itself.
I'm so excited about this year's contest!! Thanks for the post!!
Was registration opened for only one day?
It's still open. You just need to sign into your facebook account to be able to register, as it says on the site.
For human track, will there be only competitive programming type questions or other?
All tracks will have questions similar to the kinds of things you'd see in competitive programming contests. You can see our questions from previous years as an example of what you can expect.
Is it still open now or has it closed? I can't see any registration button for round 1, for practice round it is still open though...
I tried creating an account, but it got disabled citing it doesn't follow community standards, and that I can't request a review of the decision. So, is there anyway you can help with it?
Finally, a chance to get t-shirt :))
Excited !
Can anyone please tell me if the registration for meta hacker cup round 1 has started or is it already finished, I am able to register for practice round but there is no button to register for round 1
It has started and hasn't finished yet. You must log into Facebook to be able to register.
What Kind of questions can i expect in Round 1 ?
You can look at our questions from previous years to get an idea of what types of questions will appear in each round
I am unable to register for round 1
registration has not started yet i think for main rounds!
If you register for the practice round, we'll automatically register you for Round 1 afterwards.
I cant update Email Address. I already updated my email at facebook account, but hacker cup site dosent get my email and I cant even write my email.
I just looked into the code that shows emails on the profile page and the Hacker Cup code doesn't even store your email. We're just reading from your Facebook user's primary email. So technically it seems like is/should be impossible for these to get out of sync with your Facebook email.
Can you please send me a direct message explaining why you think these are out of sync and what you did to update your facebook account's primary email?
https://codeforces.net/blog/entry/133675
I dont know how to put picture in comment, so I write at blog
i bet that problemset will have over 100k words
I just opened hacker cup website and got to know that I finished in top 2000 in round 2 last season. I missed the t-shirt claim process. Can I claim now?? Hopefully not!! :)
I have my email linked to my Facebook account, but it still doesn't appear on my profile.Could you please advise on what to do now ?
mine has not updated also ! Did your email updated ?
It seems like the issue hasn't been resolved yet. As SecondThread mentioned earlier, they get the email from Facebook’s primary email. However, I'm still unsure what the exact problem is. My email is public on Facebook, so there shouldn't be any issues with visibility.
i updated my email just 1 hour ago! Is it necessary to have an email to get a t-shirt ?
I guess the only way for communication regarding prizes is email.
Bro,if your problem get fixed then plz inform me also!
The contact info we use here is your primary facebook email. The easiest way to update this is in the facebook app if you go to Menu > Settings & Privacy > Settings > Search for "email" > Email, and then updating your primary email.
I have clicked on Email, but I don't see any option to update the primary email. All there is, is some notification settings.
can you update "Edit this in your Facebook settings" to the correct place?
Open Facebook mobile app (not Facebook lite), and then
1) click on Menu (3 horizontal lines)
2) Settings & Privacy
3) Settings
4) Search for "email"
5) Email
6) Primary email
7) Enter the email you want to add, if you get an error then try adding other email.
8) You get an OTP on mail , Enter it
This worked for me !
Every time it is saying wrong email , even after entering 3 different mails.
I have successfully registered for the practice round, but when I attempt to access Round 1, it shows on the left side that I have not registered for this round. Could you please tell me with the registration process for Round 1?
You will be registered automatically if you registered for the practice round.
Can I register for it now ? Or am I late
You can still register.
I have solved 2 problems in the qualification round in Human track but I don't know if they are accepted,they are just showing a question mark there
How can I register, can you please guide me ?
During the contest, you won't know whether or not your submissions are correct. Now that the contest is over, you should be able to see the result.
What are the rules about AI for the human track? Can I ask for hints, solution, boilerplate code, debugging, refactoring, etc even though I’m participating in the human track? If not, how would that be enforced? Thank you.
The FAQ has been updated — https://www.facebook.com/codingcompetitions/hacker-cup/2024/round-1/faq
Yes, AI includes o1
Thanks for the answer!
MHC Round 1 conflicts with the 2024 ICPC North America Qualifier (NAQ) which happens at 11:00 — 16:00 PT on October 5th. Considering many universities in NA use NAQ for team selection for ICPC Regionals, will there be another bye system setup like there was last year? Not sure how this would work since the only round before round 1 is the qualification round.
And alternatively, can future MHC rounds happen on Sundays since it seems like there will always be ICPC conflicts on Saturdays in October/November every year.
SecondThread
We won't be offering alternatives to Round 1 this year. We hope to see you on the scoreboard; of note, you could likely use the first hour of the contest to qualify for round 2 even if you're participating in NAQ.
SecondThread since you are not offering alternatives to round 1 this year, can you at least change the requirement for qualifying to round 2 to be a points lower bound (like it has been for nearly 10 years)? I know last year the requirement was originally top 5000, but changed to 4 points due to system issues. But considering the NAQ conflict, 1 hour may not be enough to solve enough problems to secure top 5000 (especially if there are system issues in the first hour).
Nope, sorry. I believe in you though!
Hi, SecondThread. I am not able to submit for the older contests that I participated in. As opposed to a Submit for Practice button for the contests I didn't touch, I see a Submit on Home Page button now for the contests I've submitted once for, but there is no Submit button on home page.
Can you help please? Here are pictures. (I'm unrated, so I can only link them.)
UPDATE: They fixed it.
For me it has an option to "Download encrypted problems and input" but when I press it shows an error.
I'm seeing the same now. It wasn't there last night. Anyways, it's still not working for some older contests.
UPDATE: They fixed it.
Yep, should be fixed now. Sorry for breaking it!
No problem, thank you for fixing it :)
There is no countdown for the timer before it expires, How much time we have to run the solutions ?
In human track we have 6 minutes. Below the validate and submit button it shows the time remaining.
I hope I get a t-shirt this time!!
The input files in the HackerCup are quite large in size. VSCode crashes if I run my source code with the large input file and there is no output. Does anyone know how to resolve this ? Also tried using Sublime but didn't help much.
Consider increasing your stack size https://nor-blog.codeberg.page/posts/2023-09-25-increase-stack-size/
SecondThread Do the problems in the Practice Round have a TIME LIMIT? I couldn't find any info related to this on the contest platform and after submitting the solution to a problem, we can't see the judgement of our submission. If yes, how to know if it is 1 sec or 2 sec or 4 sec?
There is no official TL because the solutions are not run by the system.
You just need to submit before the 6-minute timer expires. Considering you need a minute to download the input and upload the output, the TL is somewhere around 300 seconds.
If it's helpful, all of our judge solutions run in a few seconds to all problems on a modest laptop
But is it ok to submit a solution that takes a minute for example?
Yeah, if it takes less than like 5 minutes, there's no way we're going to DQ you.
How does the round system work? Is each round independent and just for the qualification of next round. Or There is some accumulation of results of each round (like prefix sum) that is taken into account for next round?
Each round is independent, as mentioned in the contest page.
Why do I have to go through such a long and convoluted process to just upload a submission? This is annoying
Post contest discuss stream for practice round
Btw how is checker of Fall in Line implemented?
It's less exciting than you'd think. When we generated the solutions, we naively found the best lines and counted how many points were on it. The checker is given the optimal answer, so it doesn't have to calculate it on the fly, it just checks if you're within x and 2x the number it is given.
In Problem 3 Fall in Line (very nice), luckily for me I think the trivial case with 3 ants not in line was not in the test cases. My code output is 3 (n instead of the smarter n-2) — correct answers are 1 or 2. I realized after submitting and I was almost sure it would have ended up in WA. This year favourable test cases :D
In this case any pair of 2 distinct points $$$P_i, P_j$$$ is a "witness" for a line with $$$p==2>=3/2==n/2$$$ points lying on that line. Maybe You've just rounded $$$n/2$$$ incorrectly while doing the comparison $$$p ?>=? n/2$$$.
Anyways, problem C was a real "little delight"! ^_^
Getting random points 3 by 3 to find clues for possible lines with >n/2 points. As there aren't 3 points aligned, it outputs n. It always works, except with n=3. Outputing n-2 it would have always worked.
And yes, C and D2.
Happy to hear you liked it!
I am surprised that intended solution for D2 is AVL/Splay/Treap instead of this geniosity
Mine is very similar (I do not know splay/treap):
Can you please explain the idea behind your D2 solution? Thanks.
Assuming you already solved D1 and know that we only need to find the final positions of the stones:
Now watch what happens when we throw a stone:
--X-XX----X
we throw a stone with $$$E_i=5$$$.-X-XX--X--X
Can you please explain your D2 solution?
Wow that's brilliant. Wondering how this works though, would love to know the intuition behind it
hey SecondThread , in the practice round my ranking in my country is not showing but it is showing in global , in my profile and in the certificate . what is wrong ?
If anyone knows the answers to these queries, please comment.
Why does it matter how they check our solutions, if your output.txt is correct, it’s correct no matter how they check it.
Please answer other questions too
https://www.facebook.com/codingcompetitions/hacker-cup/2024/practice-round
That is the only round where he could prevail, LOL
SecondThread, hi, sorry for bothering you, but I need help.
I ran into some problems registering facebook account. Intially I had one account and now it's perma-banned. Don't know the reasons, yet I participated with it previous year. Decided to register new and got insta-disabled. I didn't worry intially, I just sent appeal.
Today, they reviewed my appeal (which is just photo of me) and still decided to perma-ban me.
The question is how to register facebook account without getting banned. Or how do I restore my previous accounts, if that's possible.
I hope it's not too late, thanks for help in advance
same problem for me :(
I managed to get around that disabling BS. Both of my previous accounts were registered just using an email. And I decided to register a third account, but this time I did things a bit differently:
I think the second step is key, though I'm not 100% sure if it's sufficient on its own. Try it at your own risk, lol.
yeah worked for me aswell, unfortunate situation
SecondThread my FB account is linked with my real age 17 , and I'm not allowed to participate
Any solutions or T_T
Unfortunately you can't participate until you're 18. Lawyers say so.
Laws are trash :/
All math?
How so?
Unless we say that all CP is math (which is true but useless), D and E are not math, and calling even A math is a stretch.
How to solve C?
Let $$$E_L$$$ be the expected no of moves to reach $$$W-1$$$ from $$$W$$$ and you are not allowed to go more than $$$W+L$$$.
When we reach $$$W-1$$$, the expected no of moves required to move to reach $$$W-2$$$ from $$$W-1$$$ is still same $$$E_L$$$, since we are not allowed to go more than $$$W+L-1$$$.
Therefore the answer is $$$(W-G)*E_L$$$.
Now let focus on $$$E_L$$$ now,
If we go left, we are done, if we go right, then we will need $$$E_{L-1}$$$ moves to come back and then another $$$E_L$$$ moves to go 1 unit left.
$$$E_L = 1+0/2+(E_L+E_{L-1})/2$$$
This gives $$$E_L = 1 + 2*L$$$.
The overall answer is $$$(W-G)*(1+2*L)$$$
"This gives $$$E_L = 1 + 2 * L$$$"
I don't see how you can get from the previous step to this.
Subtract $$$\dfrac{E_{L-1}}{2}$$$ from both sides
$$$E_0 = 1$$$, since we are forced to go left.
$$$E_L = 1+0/2+(E_L+E_{L-1})/2$$$
Moving stuff around, this simplifies to $$$E_L = 2 + E_{L-1}$$$.
$$$E_L = 2 + E_{L-1}$$$
$$$E_L = 4 + E_{L-2}$$$
$$$E_L = 2*i + E_{L-i}$$$
$$$E_L = 2*L + E_{0}$$$
$$$E_L = 2*L + 1$$$
Thanks!
If you find the expected number of moves to reduce the minimum achieved weight by $$$1$$$, you can just multiply this value by the difference of the weights to find the answer. Memorylessness.
Let's find this value. You start at $$$0$$$, You move left or right on the number line with equal liklihood, except when you are at $$$L$$$, you only move towards the left.
Expected number of moves to reach $$$-1$$$ is needed, which can be found by solving a system of equations. This is the approach used by most contestants, I believe.
I would describe another approach. Let's say that you are well aware of the following fact:
If you are on the number line at $$$0$$$, moving left and right with equal liklihood, and want to stop moving after you reach either $$$-a$$$ or $$$b$$$, then the expected number of moves needed is $$$ab$$$. This can be proven by solving a similar system of equations. But, this fact is more well known (look into gambler's ruin).
In the problem, you seem to have only one choice when you are at $$$L$$$, that is to move left. Say you remove this restriction and allow yourself to go to $$$L+1$$$. Assuming that your world has been reflected. In this reflection, $$$-1$$$ will appear at $$$2L+1$$$.
Now, this has been reduced to the version of gambler's ruin bounded on both sides, with $$$a = 1$$$ and $$$b = 2L+1$$$. The expected number of moves is thus $$$2L+1$$$.
Excuse me, where can I find the proof of this version of "gambler's ruin bounded on both sides". Basically, "If a and b are positive integers, then the expected number of steps until a one-dimensional simple random walk starting at 0 first hits b or −a is ab."?
C is same as these
Problem D is something...
Edge cases must be insane. I thought I covered all, but still WA...
Second part of the problem is simple DP after you replace every
?
with1
as it always yields a string with maximal number of splits.First part of the problem was to split the string in groups of length 1 or 2, with each group having independent choice of options. My cases were:
0
in string forms a group of length 2 with previous character and itself. If previous character is?
, options are20
or10
; otherwise there is 1 option.0
groups, we get everything else split into sub-groups.?
with0
.?
, we have 9 options; otherwise there is 1 option.?
, it forms a group of its own with 1 option.?
at the end of the sub-group, if the previous character is?
a group of size 2 and 15 options (26
,25
, ...,21
,19
, ...,11
); if the previous character is2
a group of size 1 and 6 options (6
, ...,1
); otherwise it's a group of size 1 and 9 options (9
, ...,1
).?
not at the end of sub-group, if the next character is7
,8
or9
, we have 1 option (1
); otherwise we have 2 options (2
,1
).The key intuitions here was to split out
0
groups, and after that3
—9
can only be put at the end of subgroups,2
can be put only if the next character allows it,1
can always be put and0
can never be put. So I think that??0
was trickiest case as it has 18 options, because first character will always be on its own.What edge cases did you already cover? I can't say that my solution explicitly "covers" any particular edge case.
To expand on my solution here a bit.
If the string is known, the problem is classical. It is the number of paths from $$$0$$$ to $$$n$$$ on the following graph:
It should be clear that all edges that this graph can ever have are present if every
?
is replaced with an 1. However, some of these edges might not be part of any path.Find all edges that are part of at least one path and discard all others. Now you have a bunch of constraints that the string you construct must satisfy. Strings that don't satisfy all these constraints will certainly have fewer paths from $$$0$$$ to $$$n$$$. I believe that this step is the key to avoiding having to explicitly handle many cases in your code. At least, doing this you make sure that you don't have to think about it.
The rest of the solution is standard. Let $$$\mathrm{dp}[i][k]$$$ be the number of ways to fill the characters starting from the $$$i$$$-th, under the assumption that the $$$i - 1$$$-th character is $$$k$$$ (where we can treat $$$k = 0$$$ as a stand-in for $$$k \ne {1, 2}$$$). If $$$\mathrm{dp}[i][k]$$$ is too large, treat this as an infinity.
what does 'good' array stands for in your code
good[i][0]
is set to true if edge $$$i \to i + 1$$$ was not removed;good[i][1]
is set to true if edge $$$i \to i + 2$$$ was not removed.How do you construct the k-th lexicographically largest string after calculating the dp?
Go from left to right. Try putting every character in the current position. Using the DP values you've calculated you can find out how many solutions are possible with this character. If too few — try the next character instead.
Thank you!
Are the problems available for practice now that the contest has ended? I'd really like to know if my solution to D works as I was late by just a few seconds in downloading the input.
They will be in a bit
After thinking about E for a little while, I was bored and decided to just write O(2^N * |S_i|) and see if it passes. It did, taking about 5m to run on my PC. I think this is a pretty bad situation for the MHC format: I have a pretty strong PC and I am almost certain that my solution would have TLE'd on the median contestant's PC. (I also think my solution would have TLE'd on stronger test data, e.g. 105 copies of the case with 25 strings of 100 question marks.) In general I think it's bad for a possible solution to be on the border of TL (even if that solution is not intended), but it's especially harmful in the MHC format because whether or not you pass is largely based on how good your computer is, not just how well you do your constant optimization.
I hope there's a faster intended solution, though even if there is, I think this situation is still bad: I'm pretty sure a large fraction of the E ACs used the 2^N |S_i| approach and it's clearly an advantage to be able to pass with this solution.
(Incidentally, has anyone tried writing code to execute the test cases in parallel? I'm not an expert on parallel computing, but I'd imagine that on PCs with many processor cores this could sufficiently speed up execution.)
Thanks for the round!
tourist did.
I'm using golang and my E took about 60seconds.
That's what makes MHC "fun". People should be allowed to use their own resources to solve problems.
Author's solution is something like $$$2^{N} \times (L / 16)$$$. We expected powerful desktops to handle all test cases successfully for $$$O(2^{N} \times L)$$$, and that's exactly why this problem is in Round 1: for this problem not to decide participants, who advance to the next round.
Why not remove it then? All it does is leave a bad impression about the round (not that i had any good impression left after last year)
+1, I'm not really sure whose experience is improved by the existence of this problem? I'm really disappointed to hear that the intended solution doesn't involve an algorithmic improvement from the brute force; my solution path looked like "immediately come up with $$$2^N \cdot L$$$, assume that surely that isn't intended, spend 40 minutes thinking, and eventually decide to just implement the solution, see if it passed, and move on with my life." This is only R1, it's okay for a lot of people to AK; I think it's far worse to have ranks decided by who has a better PC (especially when the problem isn't interesting enough to compensate).
I don't know what you mean by algorithmic improvement, but it seems that you couldn't find an algorithm that computes value for each subset faster than in $$$O(L)$$$. While there are few of them, actually. If you want more like mathematical puzzles, you probably should ignore problems like that and find problem you like somewhere else.
My experience in this round was improved by this problem. I liked the problem statement idea. The $$$O(2^N \cdot L)$$$ solution was easy for me to come up with, and even though it was enough for me to pass using a multithreaded template, I enjoyed thinking about ways to optimize it. Optimizing it $$$16$$$ times is a legit "algorithmic improvement" in my eyes.
I would not want to see this problem in Round 2 or any other round where it would decide anything. It's perfectly fine for Round 1, and I was happy to see it.
I really wish sometimes that we, as a community, were mindful and left more positive comments about the work of problem writers.
look at the author's previous comments about other problem writers lol
My comments were mostly about coordinators, who haven't filtered really bad problems that gave too much freedom to cheaters and affected rating. Those people have done their job poorly and couldn't properly prevent massive cheating. Examples are pure mathematical problems of level Div2D+, where you can simply share formula and there is absolutely no way to catch cheaters after that. Also, poor round testing and wrong point assignments. So I was mostly furious because of good problems were wasted as a result of poor coordination and authors were more like victims there.
Funny you say this and C is literally a one-line math problem
that's complexity is per test case right? I TLE'd with the same thing. Although yeah it doesn't really matter because its round 1
I dug up my codejam parallel template from like 2015 or 2016 and got E passed in like 3 minutes. Then I ran it normally in 1 thread and it took 6:34. So yeah, in my case AC and TL were separated by the number of threads, which is probably not good (on the other hand, this is a direct consequence of the contest format I guess)
Other than your PC being fast or slow, this highlights another issue. You can't be sure what actually is in the test case. In theory, the file might consist of 105 test cases with $$$N = 25$$$ and $$$|S_i| = 100$$$ for all $$$i$$$ where your code actually runs in $$$\Theta(2^N |S_i|)$$$. But that's likely not the case. For many solutions I can think, many maximum tests are "easier" and there might only be one or two "hard" test cases. Finding out if this is actually so is a massive gamble.
I would say, in this problem there are three separate states:
You solved this problem and your solution works way faster than 3 seconds per test case.
Your couldn't solve it in a normal way, but found a good way to implement slower solution and got your points (it gave you nothing but a higher rank in the standings of Round 1).
None of the above. Not critical at all.
It could've been critical, if the problem affected someone's CF/AC/whatever rating or spot in the next MHC Round. But not the case.
Anyway, congrats to everyone, who is in the first state.
I think another solution is that you take some slightly slower solution, and run it on $$$16$$$ testcases at the same time. This is essentially the same as doing the total time $$$/16$$$. What is your view on this? You can calculate that your solution should run in time, only you don't use bit parallelism but actual parallelism, is it really that different? (Of course it is much less 'cool', but what makes this not a legit solution?)
Within this competition's format it sounds totally legit to me. I agree that it makes a lot of sense to have parallelism at your sleeve for cases like that. This way or another, you will get these points. Then it's everyone's choice if they want to find a solution, that works for ICPC format as well.
Threading worked.
I was implementing a $$$O(2^N \times 26)$$$ solution. Using meet in the middle and breaking bit strings into two $$$64-bit$$$ numbers.
For a binary string with only '?'s and characters. One can compute the number of nodes required by splitting the string into $$$4$$$ $$$25$$$-bit numbers, having precomputed counts for all $$$25$$$-bit numbers and merging these by linear combinations.
Somewhere around, I realized that I wasn't sure whether this would pass. I was using an M3 Pro with $$$11$$$ cores, so I ran each testcase in a separate thread and it passed. Took 3 minutes. Meet in the middle was still required, however, for memory limits.
I ran them in parallel (Kotlin), took like 40-50 seconds. Serially it seems like it would have taken 7-8 minutes, so I actually wouldn't have gotten it.
I also wrote a $$$2^N |S_i|$$$ dp, but didn't bother at all with optimization. I used STL maps and sets, everything was single threaded, my PC is a 6 yo laptop and it run about 4 minutes (minGW + WSL). I liked the problem even though this solution was a little bit to straightforward to come up with for the last problem in the contest.
I'm in fact surprised that so many people TL'ed this problem :thinking
I checked your code, and unlike many of us that just did a straightforward for (mask = 0; mask < (1<<N); mask++), so we always explicitly iterate all 2^N possibilities and then for each one we intersect those patterns in order to do the literal exclusion/inclusion formula, your code uses two maps as queues and does some interesting swaps so it is quite more involved in the way things are computed.
I assume that because of that it only looks at "interesting" subsets, and this is bound to be much faster in practice (the straightforward inclusion-exclusion formula always has 2^N terms to add/subtract, no matter what are the input strings).
If I am not mistaken, your code can be described as an "optimized version of inclusion-exclusion formula", where you go element by element and try "intersecting it" with all previously existing sets to construct new sets, while critically deleting anything that becomes empty.
So I think you did bother with optimization! At least compared to mine / other people's brute force version :)
Thanks for the exhaustive reply. Very interesting point, I would think that the tests would blow the number of interesting masks straight to $$$2^N$$$ after just a few iterations. So maybe in practice this really is somewhat faster.
The queues are "masks for current character index" and "masks for the next character index", in a fashion similar to 0-1 BFS.
Update: Round 1 is now complete. We had a flood of submissions during the last few minutes during which everyone refreshed the scoreboard and we appear to have exceeded our number of allotted DB connections. We're looking at resolving the issue now.
Connections have recovered
Any reason why the "Validate Solution & Submit" is grayed out? Would love to upsolve https://i.imgur.com/BRLWJ9t.png
It is working now. Happy upsolving!
Extremely weak pretest for problem D. Nearly every false solution can pass.
I think that was part of the challenge :)
E test data is also quite weak, I managed to pass all but one of the test cases even though my solution outputs the wrong answer on:
(4 instead of 3) since I forgot to delete some if statements from my solution. Anyway, not a good idea to rely on validation data being strong. :)
That feeling when you realize the solution is O(t * 2^n * |S|), with t = 105, n=25, |S|=100, and you are using Python.
After a lot of tweaking, I got it down to taking about 5.2 min if I run 8 instances of PyPy in parallell. But seems all the tweaking caused me to get WA instead =(.
is this the intended solution? lol i couldn't get this to be fast in C++
I think so. Only after the end did I realize that with some bitset magic, you can probably speed it up like a factor of 16 by using that you can store 16 alphabetic characters in a 64 bit int.
64/log_2(26) is 13.6 :susge:
My solution works in $$$O(B2^B+T2^N(\frac{|S|}{B}+3))$$$ lol. It managed to run in 55 seconds with $$$B = 25$$$.
Python 3.13 is on the way
SecondThread would there be plagiarism checks?
Yes, we haven't started them quite yet.
Thanks, please do them, disappointed in seeing quick influx of submissions at the end and my rank dipping so quick
So you're basically disappointed that people solved the problems?
&
SecondThread
IDK why there is a need of getting the code file, if that is not checked after running whether it is giving correct output or not. There are some users who just get the output files maybe from some of their friends or just buy them and then just submit any random code. Below is an example, check his submission in Problem A. Not only that, he had done same thing in Hacker cup 2023, round 2 also. You can check any of his source code file.
See image here: https://ibb.co/K688bPt
Please do something about this, there are some genuine users who don't get to qualify by 2 or 3 ranks.
Great problemset, I enjoyed problem B and C a lot. Problem D looks like a pain to implement, if the approach I came up with is correct, which I'll see in practice mode later. Thanks for the contest!
My ranking is 5055! 1st problem was quite difficult for me. I hope at least 55 people get rejected for cheating(lol)
Hello, is it possible to account for the problem if it is correct but i forgot to compile the latest version before saving answer to output file on my PC. The source code I added is correct.
I think they Don't run the code. So as long as solution file is correct you are good!
For some reason my score is 31/100, despite solving the first 3 problems? It should be 51/100 or am I missing something?
What's your handle?
Benjamin Kleyn (kriepiekrollie)
I reported the same issue (handle: Edvard): in the last 15min of the contest scoreboard was showing correctly that I submitted 4 problems but the score was 51 (as if 3 problems were submitted).
Did you fail systest on C?
Doesn't look like it
thats a really weird bug, hope that SecondThread will fix it soon!
I was scrolling through the score board. Found one with the opposite issue, 2 solves but has 51 points. Maybe Navin stole your points =p
XD
Scrolled through all of top 5000. In total there are 6 people with a buggy score. One with more points than indicated by the solved problems, and 5 with fewer points. So you are not alone.
When are the problems be available for practice now?
Yes, you should be able to submit to practice now.
It's not working for me, it just says "Timer expired"
Same
I try to submit at the front page, it tells me Unable to create submission. I cannot even submit the test case in the practice round which is 2 weeks ago.
Can someone submit for practice ?
I can't see it, please tell where to do it
Hello, where can I find the upsolving of the First Round?)
Hey,plagiarism checks finished?
&
RIP to those who
break
early before reading all input and passed all the validation TC for A...The interesting thing is that, when I try to submit the problem D in the last minute, and after revealing real result, I get a wrong answer on problem D and .... my ranking even increased a little.
why can't submit problems after contest ended?
I had no time to do the contest fully and I had a floating point inaccuracy in the first problem final submit testcase (36.000000 <= 36.000000 was false, I thought setprecision remedied this but I was wrong). From rank 2200 to 5500. Oof. I forgot that the feedback to the submission is given after the contest. If only, the format was like Codeforces. Eh I guess better luck next year.
That is a perfect example of why you should use rational numbers instead floating point numbers. Especially on a problem like this where it is straight forward to solve it with rational numbers.
How reliable is decimal.Decimal for these problems?
There are many reasons I would avoid decimal. I guess decimal is fine if you want a really high precision floating point number, and you don't care about speed. But if you want provably correct solutions, then you should stick to fractions.
For problem A was it necessary to use fractions to pass?
Passed with
double
, I did try some corner cases before submitting.As far as I know, setprecision only affects the amount of digits outputted. pajenegod's solution using fractions is very clean, but for future reference, you can also use an error term
eps
(i usually set it to something between $$$10^{-7}$$$ and $$$10^{-9}$$$) and check if a > b + eps instead. This is usually enough to mitigate precision errors (though I also spamlong double
s just to be safe)I was using only long doubles. Most times that is enough. I was aware of the epsilon fix but was too lazy and did not realise I had a precision problem because it was in the final testcase and delayed feedback of that. I guess now I have an actual example to fallback on why to use epsilon.
Would you mind sharing your solution code as well as the fractions that were being compared incorrectly? Because I just implemented the straightforward floating point solution without any epsilon and it passed.
It was my check that had the problem, "(i+1.0L)/speed <= segments[i].second)" was the condition where 36.000000 <= 36.000000 was false. I understand that I could have just kept the information of both minimum speeds and maximum speeds and used them but because the time complexity allowed it, I thought that my check would have been better and well it came first to mind than the minimum and maximum speed check. Oh, how wrong I was. It is a bit scuffed that I took ints in as doubles but that should not be that problematic?
I see. If you had compared minimum / maximum speeds there wouldn't be any issue.
Reasoning: If you want to compare two fractions of the form $$$a/b \le c/d$$$ where $$$a,b,c,d\le 10^6$$$, then double precision suffices since it has $$$15>12=2\cdot 6$$$ digits of precision
Interesting. I used epsilon then it gave me correct answers. What about long double precision, I used long doubles. I defined double to be long double.
The precision of long double vs double is platform-dependent. E.g., on codeforces you will get 18 / 15 digits of precision from long double / double respectively, though on my computer I just get 15 printed twice.
I gained new insights because of my mistake. Thank you for some of them! Now I am just confused about how even <= works for doubles and how many digits does it compare, because sometimes 0.0 does equal 0.0 but sometimes not, I understand that it did not matter whether I used double or long double, as the important digits were accurate, <= would read the inaccurate digits too, I think but I am not sure any more.
https://en.wikipedia.org/wiki/IEEE_754#Directed_roundings
Basically, if you are computing the quotient of two integers in double precision, the result is rounded to the nearest possible double. So it is safe to compare quotients of integers if you have enough digits of precision, because rounding occurs only once.
However, in your solution you have two divisions:
Which effectively causes rounding twice instead of once. This introduces imprecision (regardless of whether using double or long double).
Oh okay, Thank you for taking the time to answer. I understand the problem that my code faced now a bit more. I guess long double was not enough to remedy this, probably is the same as double in my operating system (Edit: I checked, long double is 18 and double is 15 for me).
3000 AC for problem C,seems a bit much.
&
B killed me, the of idea of twin primes directly came to my mind, but I read $$$10000000$$$ as $$$10^8$$$ and lost about 40 min, thinking and googling a method which can find twin numbers in $$$O(\sqrt{n})$$$
You can just store all of those primes in memory ;D
O(n) (precomputation) is enough for 10^8, considering you have like 5 mins to run it.