SecondThread's blog

By SecondThread, history, 2 years ago, In English

Meta Hacker Cup Round 1

Good morning! Meta Hacker Cup Round 1 starts on Saturday, September 10th in under 48 hours! You're automatically registered for Round 1 if you solved at least 1 problem in the qualification round.

Important info:

  • You'll qualify for Round 2 if you score at least 15 points in this round.
  • You won't know whether your submissions are correct or not until after the contest, so it may be wise to solve more problems than you need in case some of your submissions end up being incorrect. Just like in the qualification round, you'll be given validation data, but there may still be cases not in validation data which could trip you up.
  • The round will last 24 hours, and you may use as much of that as you would like solving problems. As usual, you may not discuss solution ideas or code until after the 24 hours is over.

T-shirt winners will be decided in Round 2, with shirts with a special badge decided in Round 3. You'll need to pass this round to be eligible for winning a shirt or advancing to the final round.

We’ve put a lot of work into these problems, and we hope you enjoy the contest. Good luck, and see you on the scoreboard!

Update: Round starts in under 10 minutes, good luck!

Update #2: Editorial

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

| Write comment?
»
2 years ago, # |
  Vote: I like it +31 Vote: I do not like it

Hope to see some amazing Second Problems!

»
2 years ago, # |
  Vote: I like it +18 Vote: I do not like it

Hi, Will the submission pattern be the same as the Qualification Round, i.e. 6 minutes for submitting the code and the output?

Thanks

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

    Yes.

    • »
      »
      »
      2 years ago, # ^ |
      Rev. 4   Vote: I like it -8 Vote: I do not like it

      In question B1, my timer expired because of large testcases and it show presentation error, my solution is correct. what should i do now.

      I have passed b2 but not b1, So sad. Any another way?

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Wasn't it 25 points for qualify? Is it updated?

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

    There have been different scoring requirements and different score distributions for different Hacker Cup years, if that's what you mean. With different problem sets, we expect a different scoring distribution this year from what we have seen before.

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

      I too saw that it was 25 points prior to the round, and then later changed to 15 points. Was this simply an error initially? Your response doesn’t address that.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        We decided we didn't want to dunk on people who failed A1 or B1 somehow so we changed it.

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

          Cool. That seems reasonable — question A had a fair bit of casework. Thanks for taking the time to answer everyone’s questions.

          Out of interest what’s a good number of R2 qualifiers do you think?

»
2 years ago, # |
  Vote: I like it -14 Vote: I do not like it

Definitely Round 1 gonna include enjoyable problems and it is more challenging! Only 24 hours. Enjoyed the qualifications phase problems much especially B2 even though I got WA on it!

But please increase the submission window of 6 minutes.

  • »
    »
    2 years ago, # ^ |
    Rev. 2   Vote: I like it +30 Vote: I do not like it

    Then maybe some people like me may use it for passing brute force solutions if the time is increased. Already it's bad, most of the time they generally expect that the optimal solution will print the output within 30 seconds. Considering downloading and uploading time to be of 30 seconds, still, you have 5 mins => 300 seconds left, you may still pass your $$$O(n$$$$$$2$$$$$$)$$$ solution with some early break conditions.
    A permanent solution would be to submit our codes and then wait for the verdict as we have in almost all other coding platforms. Otherwise, some will suffer whereas some may use it for passing non-optimal solutions :)

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

      It doesn't take technical issues on the participant's side into count though.

»
2 years ago, # |
  Vote: I like it -10 Vote: I do not like it

What if the compiler doesn't print everything depending on the given test? (It happened me in qualification round) Does anyone know of an online compiler I can use?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You'd better use local IDE for Meta Hacker Cup rounds (and in general).

»
2 years ago, # |
  Vote: I like it +3 Vote: I do not like it

When will the problem B2 or qualification round will be availabale for submision ? I am waiting for it from the time qualification round finished :( .SecondThread

»
2 years ago, # |
  Vote: I like it +6 Vote: I do not like it

Why is B2 not available for submission? Also, when will it be available?

»
2 years ago, # |
  Vote: I like it +246 Vote: I do not like it

What's the point of making Qual and Round 1 both basically "solve one problem"? Isn't one such round enough? What do you think about allowing, say, participants who advanced to Round 3 last year directly to Round 2?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it -32 Vote: I do not like it

    Solving only A1 or B1 is not enough to advance to Round 2. So the bar is a little bit higher than it was in the qualification round.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -40 Vote: I do not like it

      Why not? 10 + 12 >= 15. The bar was 25 points in the past, but this time it is 15.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it -20 Vote: I do not like it

        You are describing the A1 and B1 solve scenario. Two problems.

        Early rounds filter out the participants and at the same time also test the platform for any possible glitches. The qualification round had a rocky start. Relaxed requirements in the current round mean that worthy participants still can advance to the next round even if they happen to be unlucky to still encounter bugs when submitting some of their solutions.

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it -9 Vote: I do not like it

          You're right. I mis-read your statement.

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

    If you didn't know, you are not the only one participating in this

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

      Thanks for clarifying! I was worried I wasn't allowed to participate because I too thought that Facebook Hacker Cup was meant to be Um_nik's personal contest.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it -18 Vote: I do not like it

    Agree entirely, At least they could have stuck to 25 point for round 1 barrier if they wanted to proceed with this structure

  • »
    »
    2 years ago, # ^ |
    Rev. 4   Vote: I like it +64 Vote: I do not like it

    I'm not sure why this comment has so many upvotes. Perhaps people haven't looked at the distribution carefully enough? It's not feasible to solve just one problem to advance unless you solve C, the hardest problem in the set.

    For instance: solving A2 for example would indicate you have a solution to A1 as well. The only way to get 15 points but not 25 with this distribution would be if you mess up your submission to a A1/B1 somehow, but have proven that you nevertheless have the correct solution to it by the end of contest by completing a strictly harder version.

    Regardless, even if the requirement were just "solve one problem and you can advance", doing so would be still harder than in the qualification round; the problems just get harder.

    • »
      »
      »
      2 years ago, # ^ |
      Rev. 2   Vote: I like it -25 Vote: I do not like it

      I guess the point he is trying to make is that the problems are quite easy for round 1, and tbh I don't really see a difference between the difficulty of this round and the qualification round(I would even argue the qualification was tougher), except the last problem.

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

      The commenters above can correct me if I’m wrong, but I don’t think the complaint is specifically related to the one-problem cutoff. In my view, the main objection is to rounds in which the advancement criterion is of the form “earn n points” rather than “place among the top n competitors”.

      Rounds in the former category simply aren’t as exciting, since they actively downplay the competitive aspect of programming competitions. Because other competitors’ performance has no effect on whether you advance, you are actively incentivized not to compete for high ranks (because the best way to be sure of advancement is to e.g. stress test your code before submitting, rather than to aim for a good time penalty with a slight risk of FSTing). More generally, rounds of this form feel essentially no different from solving problems in practice, losing the excitement that derives from actually competing against other contestants.

      Personally, I find the GCJ R1 format more fun: even though there’s essentially no doubt that I can advance through the round, because the round is short (three hours long) and competitive (i.e., if you don’t make an effort to solve all problems quickly, there’s a chance enough others will that you fail to qualify), strong competitors will usually give these rounds their full attention, meaning that we can have fun competing for top ranks. In the Hacker Cup R1 format, competitors tend to instead log on at random times throughout the contest period, and many strong competitors will not spend much time thinking about the harder problems because there’s not a strong competitive incentive to do so. As a result, taking the top rank in such a contest doesn’t actually mean much, further reducing the incentive to compete seriously in the round.

      None of this is to say that the problems are not nice/intrinsically interesting, but there is no shortage of interesting problems to solve for practice. Without the competitive aspect present in later rounds, there isn’t really a great reason to solve the harder problems in R1 instead of solving problems from the CF/AtCoder/etc libraries.

      I support the proposal to advance R3 qualifiers straight to R2 in the following year, as it’s hard to imagine such a contestant failing to make it through R1 and because doing so doesn’t take slots away from anyone else.

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

        Making it dependent on other's performance does strike me as a good idea. In previous years, we've always said "X points in R1 => R2" which is why it is why it is this way this year, but worth reconsidering in the future for sure.

        Last year's R3 -> this year's R2 is interesting. I think in practice it would work well, but at the same time, I can see some potential optics issues with people who aren't familiar with programming contests thinking this is us being biased towards those who have done it before, which big companies might want to avoid. Though at the same time, perhaps there are other justifications like allowing us to tailor Q + R1 to people who are newer and save the problems designed to be interesting to people who are more experienced [e.g. Second Flight, Lemonade] for later rounds where they're more important.

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

          All of this logic makes sense to me. The one other reason I see in support of the current R1 structure is that it forces contestants to AC a problem with large input before they get into competitive rounds, which effectively forces everyone to make sure they have a reasonable setup before getting to R2. If they put me in charge of Hacker Cup, I'd either remove R1 (to save problems) or make it a three-hour competitive round (in which, say, the top 5000 qualify to R2). Then, I'd format the qualifying round as follows:

          • One very easy problem similar to the current qualification round As
          • Three easy (CF ~900-1300) problems with large inputs
          • Optionally, one harder problem

          Qualifying to R1 would require solving at least one problem other than A (i.e., set a qualification cutoff higher than the score of A). For example, the cutoff could be set at the point value of B (so that any of BCDE are sufficient to qualify, while A is essentially just a practice problem), or the cutoff could be set such that both of AB or any one of CDE qualifies. The point is that the proposed qualification round (a) forces contestants to make sure that they can handle large inputs/outputs and (b) gives contestants multiple easy problems with large inputs so that if they find out after solving B that their setup is not equipped to run a large input and time out before they can submit a solution, they can solve another problem to try again.

          I should add that all of these criticisms are fairly nitpicky, and I don't see any of them as ruining the contest experience at all. These are just some thoughts on marginal improvements that might be worth considering in future years :)

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

          My thoughts:

          1. Current R1 structure allows for global time-zone flexibility which is nice (similar to Google's 3 different R1s). I tend to weigh this as important for R1 until the field is sufficiently narrowed to the ~2000 range.

          2. Top problem solvers are not currently incentivized to solve all of the R1 problems, which is a problem for "contest energy".

          3. Seeding previous qualifiers to skip rounds also takes a bit away from the "contest energy", so I'm lukewarm to that idea (plus the optics look funny). I also don't know that it really solves anything. Are top performers really not participating in hacker cup because they feel the process is too onerous??

          My alternative idea brainstorm (In contrast to Geothermal's):

          1. Cumulative scoring from R1+R2 (with R2 penalty time as tiebreaker) as criteria for R3 qualification.

          2. Missing points from R1 adds to penalty time for R2 (at perhaps a rate of 1-2 minutes per missing point) to incentivize completing all of the problems.

          3. Give out top-10 T-shirts for R1 for those that want to treat it as a traditional contest. (For some reason, free swag tends to motivate this crowd -- like free pizza often motivates Grad students :) )

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

            I'm very strongly against competitive rounds with extended time limits. 24-hour rounds aren't fair to competitors with other things to do; obviously, nobody is going to spend 24 hours working on the round, but there's a massive advantage associated with spending six hours rather than three hours working on the problems.

            • »
              »
              »
              »
              »
              »
              »
              2 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Good point. If Meta sticks a doozy in for problem C (perhaps unintentionally) and the points carried over to affect R3 qual, I can see this being bad for the contest for the reasons you mentioned. In the common case though, this wouldn't be an issue for those at the top (who are generally solving all R1 problems in <1hr).

              On the flip side, I do see forcing a significant subset of ~20k people to be tasked with getting up at 2AM to compete in a US Time-Zone "Round 1" (of comparable difficulty to this one) to be offputting as well, and I think participation would go down. The 24hr contest with lax advancement goals gets around that problem and encourages more (nominal) participation, but It has the cost of preventing an "exciting" contest amongst the top players. The time-zone inconvenience is more tolerable after a bit of filtering. Note that Google's 3 competitive R1s across the time-zone map is a good alternative, but it requires ~9 problems to be prepared vs. the 3 here.

              Maybe the nominal T-shirt reward for the subset of people that want to compete for time is the best answer.

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

              I see your point, but I actually really like the 24 hour window for FHC because if it were just a 3 hour window, then time differences would mean people on some continents can't take the contest at all (or have to drastically change their sleep schedule for a 3am round).

              But I think people have a tendency to complain about rounds when there's nothing to complain about...I don't see any urgent need to fix contest format.

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

          There could be other options to motivate people to solve all the problems, bring more competitive nature, and to keep everything within one year. E.g.:

          • Top5k in R1 advance to R2, plus those with 38 points (one unsolved A1-B2). That would motivate people to try to solve As and Bs.

          • 100 points in R1 advance to R3; similarly for Q->R2. That would allow advanced competitors to skip a round, and motivate people to try to solve all problems in a long-running round.

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

      @ Why: Rounds with point cutoff are not competitive, it seems like a waste of problems and time. I personally am very non-serious about such rounds, but I still have to login and get a couple of AC, and there are a lot of stories of people forgetting to submit anything in such rounds just because it is very low priority (and yes, I think that is format's fault). When it is a 2-3 hour contest, you have to make sure you will be available during that whole time and you'll come mentally prepared. When it's a 24 hour contest with div2B problems, you think "I'll do it while waiting in a lobby of a dota game" and end up forgetting.

      @ It is good for different timezones / newbies / getting used to the judging system: There is a Qualification round for those purposes, isn't there? I understand the need for one non-competitive round, and I think I made that point clear in my initial comment, but everybody seems to ignore that. I don't understand the need for two such rounds, I think every purpose is achievable by merging Qualification round and current Round 1.

      @ It is not enough to solve A1, you moron: Oh come on. I said basically solve one problem, and A1/A2 or B1/B2 are hardly two problems. Stop finding straw men.

      @ It is harder than Qual: No it isn't, not from qualification to the next round point of view. B1/B2 is literally a textbook problem, I actually find it disgusting that you used it in competition. C is harder, yes, but that just shows that the current format makes you waste okay-ish problems on non-competitive rounds.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it -36 Vote: I do not like it

        This ultra newbie skill should come in handy for some of your red-black ass: You can reply to someone and disagree with someone's comments without having the manners of a fucking refrigerator.

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Really? Your reply is not a proof...

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

    I'm guessing the first round was used to acclimatise to the assessment system and this round is where the official elimination begins.

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

The submission format really does suck, especially for potato devices like mine. My laptop froze up as soon as I opened the input file. Genuine question really, what benefit does the submission format really have?

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

    Some tips — programs aren't created equal. Some widely used programs will likely freeze to a crawl if you tried to open a 20MB text file even on high-end computers. But vi and less seem to open anything on anything. Also, rarely need to actually open the files anyway.

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

    You don't really need to open the file. I don't think I've ever opened the large input/output. If you're on Linux (or WSL), you can head -n 20 (or tail -n 20) at the terminal to see the beginning (or end) of the file for some sanity checks, or wc -l to count the number of lines. Presumably you don't need to see the testcases themselves as you've validated your program on the smaller input.

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

    I guess they are trying to cut down cost, by not providing online judge. Handling files (source code and output) is easier.

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

      Maybe that was a case initially, but now it's more like legacy thing/tradition, I guess.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Timer expired...I couldn't even open the file on my laptop... seriously.

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

    Never use notepad for opening those input files.

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

      can you please tell me how to handle these large input files? It just ruined my experience.

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

        open in vs code or some other ide, should work.

        Also you don't have to open the file. Use this in C++ to read from input.txt and write to output.txt

         freopen("input.txt", "r", stdin);
         freopen("output.txt", "w", stdout);
        
      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it +45 Vote: I do not like it
        ./solution < input.txt > output.txt
        
»
2 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Completed A and B, I felt that problem A was more interesting than B :)

»
2 years ago, # |
Rev. 18   Vote: I like it -45 Vote: I do not like it

Problem A2 has verrrrrrrrrrrrrrrrrrrrrrrrry large input file I couldn't submit it within 6 minutes. SecondThread kindly Accept my solution (code + output).

Update: Meta Hackercup team has fixed my issue :)

Update2: Why downvotes? problem submission is the issue with everyone right?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it -12 Vote: I do not like it

    Kindly give me your email or something, so I can send my solution to you. Thanks :)

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

    In the future, you can avoid this problem by downloading the compressed input ahead of time. We won't be able to help you with this in future rounds.

    • »
      »
      »
      2 years ago, # ^ |
      Rev. 2   Vote: I like it -38 Vote: I do not like it

      Hi SecondThread, I have this issue too for A2. My editor just exploded when I pasted the large input data. My program is lost too, and then the timer expires. Now that I rewrite the program, I want to get the input data. Only the data pack is left in my zip, but I forgot the password:( please help

      Upd: Thanks, issue has been resolved.

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

      Hi, I have this issue too with B1 with the huge input file. I wasn't able to submit my code within 6 minutes. Would be very grateful if you could accept my solution

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

is time limit written for each problem like codeforces?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There is no time limit. As long as the code produces an output and you send the output it is acceptable

»
2 years ago, # |
  Vote: I like it -97 Vote: I do not like it

What would be an estimation of the cf rating of a1,a2,b1,b2,c?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it -167 Vote: I do not like it

    a1=800, a2=1300, b1=1100, b2=1200, c=2600

    • »
      »
      »
      2 years ago, # ^ |
      Rev. 4   Vote: I like it -54 Vote: I do not like it

      [IGNORE IT]

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it -88 Vote: I do not like it

        Lmfao, 1800? Dude! It's a really standard problem

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

          Do not discuss problems until the round is finished, please.

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it -100 Vote: I do not like it

            Why? Everyone from the qualification will probably qualify anyways.

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

              is that a justification to cheating?

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -68 Vote: I do not like it

      y are my newbie children downvoting? you thought you solved hard problems? Loooooooollllll

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -53 Vote: I do not like it

      Just because you solved a problem doesn't mean it's easy and is less rated. How TF is B1 and B2 so less rated? Also, A1 is not 800.

      The number of downvotes on your comments is sufficient to tell you're mistaken and provide rubbish ratings.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it -53 Vote: I do not like it

        what the hell is hard in B, you didn't do math in high school? Okay, sir, what rating should A be?

  • »
    »
    2 years ago, # ^ |
    Rev. 2   Vote: I like it -50 Vote: I do not like it

    sorry, thought the round ended

  • »
    »
    2 years ago, # ^ |
      Vote: I like it -11 Vote: I do not like it

    You should ask that after the round ends.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

can someone tell that if the outfile file submitted is wrong but the code is correct then will I get points for that question?

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

    Nope, your code is never run on their servers and isn't used at all (other than for plagiarism checks).

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

I have stuff like #pragma GCC optimize("O3") #pragma GCC target("sse4,avx2,abm,fma,tune=native") #pragma GCC optimize("unroll-loops") in my submitted source code for problems. Can that cause any issues ?

»
2 years ago, # |
  Vote: I like it +20 Vote: I do not like it

I remember previous year, after submitting, the UI shows MD5 of the submitted file. It was extremely helpful to validate that I submitted the correct file. Was it removed?

  • »
    »
    2 years ago, # ^ |
    Rev. 2   Vote: I like it +21 Vote: I do not like it

    Related: If submitting an output file fails, the page could compute the output file hash client-side and submit it as a fallback. This way, network speed is not an issue for output files.

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

The input file is too big in problems A1 and A2, and I am not able to validate the solution, My VS code IDE is getting crash and the online IDE is not taking that big Input. please suggest how to validate.

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

    Are you opening the files in an editor and/or copypasting them?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Exactly. What is the workaround for this problem? I faced the same problem for B1 and B2

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -13 Vote: I do not like it

      There's no workaround for being stupid, sorry

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        So you knew all of these since day 1, huh?

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it -17 Vote: I do not like it

          You don't need to be very knowledgeable to avoid doing obviously stupid and unnecessary things. File IO is one of the first concepts taught in every programming language book/course. So my assumption here is: if you can solve something at MHC R1 — you should be aware of it. And if you know about file IO and keep trying copy & paste large input data into standard IO — you're just stupid.

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

      Don't copy and paste file contents into the terminal.

      If you don't know how to compile your solution into an executable on the command line (in the terminal) go read this: https://mirror.codeforces.com/blog/entry/102287

      If you know how to compile your executable, there are a couple of ways to do avoid copy/pasting the input into the terminal.
      A quick and dirty way is to hardcode the filenames into the executable:
      You can either reopen STDIN from a file: freopen("input.txt", "r", stdin);
      and reopen STDOUT into a file: freopen("output.txt", "w", stdout);

      Then after you compile your solution, make sure to place your input.txt in the same directory as your your executable solution, and just run ./solution. It should read from input.txt and output to output.txt

      But a better way, is to read read from STDIN and output to STDOUT like here on codeforces. And then redirect the input/output on the command line when you run your executable, like so:
      ./solution < input.txt > output.txt
      Notice the angled brackets: < and >. This runs the executable (./solution) and redirects all the contents of "input.txt" into the STDIN of your program (< input.txt), and also redirects the STDOUT of your program into the file "output.txt" (> output.txt)

      A slight variation of this is to use cat and pipe the output of one program to the input of another: Again, assuming you compiled your executable to read/write from/to STDIN/STDOUT, you can do:
      cat input.txt | ./solution > output.txt

      Try all of these. Then go read about cat, pipes and file redirection.

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

        really appreciate the reply, I'm saving this for the future. Thank you very much

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Don't save it for the future, learn it now!

          Sorry, but I kind of agree with gultai4ukr here (though I wouldn't put it in such harsh terms). This (file IO) is really basic stuff, and it should be second nature to you. You wouldn't "save for the future" a comment that shows you how to write a for loop.

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I wouldn't put it in such harsh terms either if it was first comment of that sort :)

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

    i also dont have any available software(school chromebook T_T), what i did was use repl.it + file io instead of an online ide like usaco.guide so you dont have to open the file to copypaste. It took me a couple minutes to set up but i was comfortably able to get it to work in time since repl didnt take centuries to run :D. if youre on a real computer there are better ways tho, im psure there was a blog on it.

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

      I suggest using Wandbox, it's online and the code is saved locally so it does not share the code to others. Do note that in repl.it, using private projects is a feature of the paid subscription.

      • »
        »
        »
        »
        2 years ago, # ^ |
        Rev. 2   Vote: I like it +5 Vote: I do not like it

        thanks so much! its 10x better than repl XD. i might stick w usaco guide for other stuff since most of my files are there but ill def use this for future hackercup rounds :D

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The same happened with me, my Sublime Text crashed.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

As my code for B1 is correct but it failed to provide the output for such large test cases and my IDE crashed while running the code,is there any alternative to submit my source code?Actually I am completely new to this platform this year and do not know much about it.Any help will be appreciated...

»
2 years ago, # |
  Vote: I like it +34 Vote: I do not like it

If you aren't able to submit to problems with large input files (or, more generally, if your I/O method involves actually opening the input file at any point), read this.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi SecondThread, For B1, My editor (Sublime Text) just crashed when I pasted the large input data. I didn't know what to do, and the timer ended up expiring. Could you please look into this issue so that I can resubmit? Nevertheless I was able to submit my code for B2 later.

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

    kk, so in general, stuff like this belongs in a clarification request instead. But like -is-this-fft- said:

    Some tips — programs aren't created equal. Some widely used programs will likely freeze to a crawl if you tried to open a 20MB text file even on high-end computers.

    It's useful to redirect standard input or output if using an IDE to run code, or pipe them in or out if you're using command line, as described here. (I'm only telling you this because we've been telling tons of people in clars, but in general, this should be in a clar, not a public comment)

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

For those whose IDE crushes after giving large inputs:

  1. Increase your stack size, but do not increase it too much as I saw for huge stack size code runs slowly.

  2. Download input before starting timer.

»
2 years ago, # |
  Vote: I like it +10 Vote: I do not like it

I have correctly approximated the upper bound of the number of vertices in problem C to be around 4e4, written the correct Dijkstra which runs in O(V^2), and my solution finished running right after my 6 minutes timer expired.

I guess I do not deserve to AC this problem with a potato computer?

»
2 years ago, # |
  Vote: I like it +45 Vote: I do not like it

C

same solution,but it took 6 min on my PC.

very sad :(

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

    I went and translated my golang solution to "passable but not optimized" python and benchmarked. I have a reasonably beefy PC; I can imagine it would be worse with potatoes. I did run single threaded to keep things reasonably fair:

    • golang -- 0m8s
    • pypy3 python -- 1m12s
    • vanilla python (cpython) -- 17m12s

    I'm sure I could spend time and optimize, but that is a pretty big constant spread between golang and vanilla python for solutions that effectively implement the same algorithm.

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

My submitted A2 failed now because of N==2. :(

Spoiler
  • »
    »
    2 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    The way I did was: Append a copy of A to back and then you do any of string matching algo of your choice and get the starting indexes where the array match.

    Then imagine the matching happens at index 'i', which means you need to move 'i' steps totally in k moves (under mod n). In K moves you can move [k, k * (n — 1)] steps which basically give you a range but we only care about mod n values. So you can actually see if the matching index lies inside this range of steps that you can do. This way you dont have to care about special cases.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there a good way to stress test problems like A2 ?

I missed one easy edge case which resulted in 2 WA.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Testing your code is a skill itself, but you can write another code to help you validate it :) Short example:

    for N in range(2, ...):
      for K in range(0, ...):
         array = create_random_array_of_size(N)
         correct_answer = brute_force(N, K, array)
         candidate_answer = solve(N, K, array)
         if correct_answer != candidate_answer:
            assert False
    
»
2 years ago, # |
Rev. 9   Vote: I like it +6 Vote: I do not like it

Is there a better way to solve the problem C with time complexity betterthan O(V^2), which V is the number of "valid" points? the V can be up to ~30000 practically. The processing time of my computer is ~10 minutes.

If not, this problem is low quality.

1, this problem is just the brute combination of convex and dijkstra, which are two very classical problems.

2, The coding language you choose also matters a lot, if you choose c++, you are good. If you choose Java, you are fine, If you choose python, you will die.

3, The hardware of the computer also matters a lot. This is hacker cup, not code jam.

4, What's worse, you only have one chance. You only get a TLE in other platform, but in this contest, you will no longer have chance to adjust your code.

5, Even you submit your result successfully, the validation input is exactly same as examples (only 5), very weak, so people would be likely to fail when the contest results revealed.

Finally, I don't think hacker cup should use online judge. But problem-setter should at least make the input fair to all the computers. If your solution is correct, you should get the result very fast. The computational speed for each computer and each coding language really various a lot.

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

    get two laptops

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

    Re 4: You don't get TLE on Systests e.g. on CF, only on pretests ans you can resubmit. MHC hat validation tests, which you can resubmit as often as you want. I think you can reasonably equate your situation in Point 4 with getting TLE on Systest on CF. (Arguing that validation should be stricter is the old "what should pretests do"-story though, I guess)

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Same solution for C, but my computer took around 25 seconds for a large test case I generated myself, which made it seem like my solution would not comfortably fit in the 6 minute time limit. Had to take a leap of faith in submitting it, which worked out for me in the end (with around 2 minutes of processing time).

»
2 years ago, # |
  Vote: I like it +74 Vote: I do not like it

I am sorry to say that but I think the quality of the problems was very low, and the problems werent intersting at all, I was expecting more from a contest this big!

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

    Agreed. B was terrible and C was worse than D from Qualification round.

»
2 years ago, # |
  Vote: I like it -8 Vote: I do not like it

For C was really intended solution just to run dijkstra on a convex hull without any further optimizations? If so then hardware quality mattered a lot.

  • »
    »
    2 years ago, # ^ |
    Rev. 2   Vote: I like it -8 Vote: I do not like it

    Did you see the proof for why it was fast? Turns out you can show that the number of points on the strict hull is O(A^(2/3)), in practice the max is 35k points. Even if you are assuming a slow computer it will run easily in 6 minutes.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -8 Vote: I do not like it

      I actually knew about the bound on the number of points on the convex hull, otherwise I wouldn't have attempted to submit the solution, however the point is that my dijkstra implementation was too slow, since I was trying to store the whole graph in memory instead of generating edges dynamically. What is interesting however is that it was even too slow to generate the graph, which was supposed to run in $$$O(V^2)$$$.

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

        If you assume that you use 64-bit integers to just store the weights in an adjacency matrix, it's already 10 GB... And if you use something like

        vector<vector<pair<long long,int>> graph;
        

        It is even worse, because now you are using 8+4 bytes of memory per edge. Using push_back to push edges to the respective adjacency vectors can cause another factor 2 increase in the memory usage, due to dynamic resizing (and because 35000 happens to be just a bit bigger than a power of two.)

        Depending on how you stored the graph and what computer you use this doesn't even fit in RAM. If the RAM is almost full the computer will start using disk memory as temporary extra swap memory to store things, but this of course results in giant slowdowns. Using and accessing a lot of memory in general makes the constant factor of the code bigger, because of caching effects.

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

I faced this weird issue today (not sure if it is a Chrome thing). The validation input file was not downloading for some reason. Clip. I even tried hard-refreshing the page using ++R (at the beginning of the recording clip). In the end, tried Safari and that seemed to be working.

After the end of the contest, I went to the Downloads folder somehow and found a bunch of random files there. Apparently, all the validation files were being partially downloaded there for some reason. Clip.

I actually also faced this issue in the Qualification round. But I wasn't really into the round anyway, so didn't try Safari back then. So this is a recurring issue, which is a bit concerning.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What operating system and version of Chrome are you using?

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      OS: macOS Monterey version 12.3
      Chrome: Version 105.0.5195.102 (Official Build) (arm64)

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

    I also experienced this issue with brave browser, so maybe it's some weird chromium thing? Restarting the browser seemed to resolve it for now.

    (macOS Catalina 10.15.4)

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

fst a2...

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Can someone explain the A2 solution? I don’t understand the what the editorial is saying

»
2 years ago, # |
Rev. 2   Vote: I like it -6 Vote: I do not like it

Resolved

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

    Based on the message you received, your solution was declared inefficient because it took too much time to run. If you show your code, then maybe the others could have a look and tell what's wrong there.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Why advanced to round 2 is not showing? Although My final score is 40/100

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    because they will remove cheaters from the round firstly.

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

      Is rank going to be better?

      Secondly, Can we know if someone cheated? Coz my friend didn't know c++, he is a java coder. In the elimination round, he submitted in JAVA. and today Strangely, 2 hr before the end of contest, he Submitted all 4 solutions in C++.

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

        1-maybe your rank will be better if there are cheaters above your current rank.
        2-I don't know, it depends on facebook detection of cheating.

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

        Yes, if cheaters are removed from above you, your rank will go up. Submissions that are disqualified have a Disqualified judgement on the scoreboard. Note that there can be other reasons for disqualification besides copying solutions.

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

          Yes! My rank Improved from 1678 to 1670. And My Dear Cheater friend got Disqualified!

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

Just curious, will Meta/Facebook actually compile the source codes submitted with the output files then check if the outputs match, and how will they detect cheaters?

For example, if the output file is the only thing that matters, I could simply ask a friend of mine for his output file on the main test, then submit that output file with a .txt file with a random program that compiles as the source code. However, if all source codes are judged, it may take a very long time and some problems will arise like input naming. I actually named my input "input.txt" and read from it, so if all other contestants do so they'll have to manually edit the source code for every contestant.

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

    Every contestant receives a different test set, so another competitor would not be able to submit your output file. The contest staff do not run every contestant's code on their end.

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

SecondThread is there any issue in the practice version of problem C ? I have tried submitting 3-4 times, but it says there is a presentation error. So, I thought that my code/output could be wrong. Then, I tried re-submitting AC submission (code + output) from the leaderboard, but it still says presentation error...

You can see my output matches with correct output: https://www.diffchecker.com/7XWT2B82 (right one is from leaderboard)

My submission.

PS: I had also asked clarification regarding this last night, but no one replied, so I thought of asking here directly.

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

    New tests are added . So i would suggest you to download the input file again .

»
2 years ago, # |
  Vote: I like it -18 Vote: I do not like it

Worst problem quality I had ever seen.

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

    Also very weak sample tests

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Are you saying this because you failed to correctly solve A2? I think that it was a perfect problem for the contest format. With a 24h round duration, figuring out all the edge cases becomes an interesting challenge, where your success also depends on your ability to stress test your solution. Also the observation that the problem A is tricky encourages people to solve B as a backup plan (which you successfully did). Skilled, but overconfident/lazy people had a realistic chance to fail if they neglected problem B and gambled everything on their problem A solution.

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

      Casework/edge cases on A can be avoided completely by using an array that is marked for every possible shift value. Iterate from k to k(n-1) and mark that mod n as a possible shift value, and make sure you only go through n iterations of the loop at max.

      Unless my solution is wrong and I was carried by luck.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Your solution is amazingly nice and clean. And it looks correct to me. Thanks a lot for sharing this information! Here's how it looks when implemented in D language:

        Spoiler

        That's much better than my in-contest submission, which was an ugly casework mess.

»
2 years ago, # |
  Vote: I like it -9 Vote: I do not like it

Why is A split into A1 and A2? They are practically identical. Is it just to filter more people by wrangling casework twice?

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

    I am guessing a lot of people can come up with the naive solution (match 1s and then see if the rest of the numbers match) but not the full KMP solution. Or they would come up with it but it would take longer.

    I was more confused about B1/B2. The B2 solution is really obvious, and I don't know if anyone would really come up with the B1 solution first.

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

      I came up with B1 solution but couldn't solve B2

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

      I couldn’t figure out the B2 solution. I eventually cheesed it using multi threading.

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Obvious for somebody — doesn't mean obvious for everybody. And yeah, I'm yet another person who struggled with B2.

      • »
        »
        »
        »
        2 years ago, # ^ |
          Vote: I like it -20 Vote: I do not like it

        You don't need to be very knowledgeable to avoid doing obviously stupid and unnecessary things. Basic math and Pythagoras Theorem is one of the first concepts taught in every math book/course. So my assumption here is: if you can solve something at MHC R1 — you should be aware of it. And if you know about Pythagoras Theorem but couldn't solve B2 — you're just stupid.

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

          Can't disagree to the bigger part despite comparison to my original comment is a bit artificial :)

          To know something and to recognize/deduce something — is completely different things. That's the main reason why it's so hard to be good in problem solving. And if you haven't any situation when you wasn't able to solve a problem on a concept you knew beforehands — I will eat my shoes.

          Also, I actually solved B2, but my point is that it wasn't obvious, at least for me. Maybe that's because I haven't solved any problem that way before...

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

      B1 was obvious brute force after seeing constraint and what we had to find. B2 took me a bit more time.

»
2 years ago, # |
Rev. 2   Vote: I like it +41 Vote: I do not like it

After solving nasty casework of A (and getting WA on A2) for half an hour, I just read B1 and B2 and was like is this it or am I missing something? It was just 5 minutes of implementation and 10 minutes of me wondering if it's this easy then I am definitely doing it wrong.