Блог пользователя SecondThread

Автор SecondThread, история, 2 года назад, По-английски

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

  • Проголосовать: нравится
  • +126
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится +31 Проголосовать: не нравится

Hope to see some amazing Second Problems!

»
2 года назад, # |
  Проголосовать: нравится +18 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +25 Проголосовать: не нравится

    Yes.

    • »
      »
      »
      2 года назад, # ^ |
      Rev. 4   Проголосовать: нравится -8 Проголосовать: не нравится

      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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    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 года назад, # ^ |
        Проголосовать: нравится +3 Проголосовать: не нравится

      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 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

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

        • »
          »
          »
          »
          »
          2 года назад, # ^ |
            Проголосовать: нравится +3 Проголосовать: не нравится

          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 года назад, # |
  Проголосовать: нравится -14 Проголосовать: не нравится

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 года назад, # ^ |
    Rev. 2   Проголосовать: нравится +30 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится -10 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится +246 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится -32 Проголосовать: не нравится

    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 года назад, # ^ |
        Проголосовать: нравится -40 Проголосовать: не нравится

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

      • »
        »
        »
        »
        2 года назад, # ^ |
          Проголосовать: нравится -20 Проголосовать: не нравится

        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 года назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

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

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится +87 Проголосовать: не нравится

      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 года назад, # ^ |
      Проголосовать: нравится -18 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
    Rev. 4   Проголосовать: нравится +64 Проголосовать: не нравится

    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 года назад, # ^ |
      Rev. 2   Проголосовать: нравится -25 Проголосовать: не нравится

      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 года назад, # ^ |
        Проголосовать: нравится +147 Проголосовать: не нравится

      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 года назад, # ^ |
          Проголосовать: нравится +34 Проголосовать: не нравится

        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 года назад, # ^ |
          Rev. 3   Проголосовать: нравится +37 Проголосовать: не нравится

          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 года назад, # ^ |
            Проголосовать: нравится +10 Проголосовать: не нравится

          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 года назад, # ^ |
              Проголосовать: нравится +40 Проголосовать: не нравится

            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 года назад, # ^ |
                Проголосовать: нравится 0 Проголосовать: не нравится

              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 года назад, # ^ |
              Rev. 2   Проголосовать: нравится +23 Проголосовать: не нравится

              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 года назад, # ^ |
          Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

          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 года назад, # ^ |
        Проголосовать: нравится +42 Проголосовать: не нравится

      @ 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 года назад, # ^ |
          Проголосовать: нравится -36 Проголосовать: не нравится

        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 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +42 Проголосовать: не нравится

    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 года назад, # ^ |
      Проголосовать: нравится +17 Проголосовать: не нравится

    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 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

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

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится +9 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +7 Проголосовать: не нравится

    Never use notepad for opening those input files.

    • »
      »
      »
      2 года назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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

      • »
        »
        »
        »
        2 года назад, # ^ |
          Проголосовать: нравится +16 Проголосовать: не нравится

        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 года назад, # ^ |
          Проголосовать: нравится +45 Проголосовать: не нравится
        ./solution < input.txt > output.txt
        
»
2 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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

»
2 года назад, # |
Rev. 18   Проголосовать: нравится -45 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится -12 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    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 года назад, # ^ |
      Rev. 2   Проголосовать: нравится -38 Проголосовать: не нравится

      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 года назад, # ^ |
      Rev. 2   Проголосовать: нравится -10 Проголосовать: не нравится

      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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

is time limit written for each problem like codeforces?

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится -97 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

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

»
2 года назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +20 Проголосовать: не нравится

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 года назад, # ^ |
    Rev. 2   Проголосовать: нравится +21 Проголосовать: не нравится

    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 года назад, # |
Rev. 2   Проголосовать: нравится +2 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +12 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится -13 Проголосовать: не нравится

      There's no workaround for being stupid, sorry

      • »
        »
        »
        »
        2 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

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

        • »
          »
          »
          »
          »
          2 года назад, # ^ |
            Проголосовать: нравится -17 Проголосовать: не нравится

          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 года назад, # ^ |
      Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

      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 года назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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

        • »
          »
          »
          »
          »
          2 года назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          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 года назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
    Rev. 3   Проголосовать: нравится +5 Проголосовать: не нравится

    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 года назад, # ^ |
      Rev. 3   Проголосовать: нравится +8 Проголосовать: не нравится

      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 года назад, # ^ |
        Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

        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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    The same happened with me, my Sublime Text crashed.

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +34 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +45 Проголосовать: не нравится

C

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

very sad :(

  • »
    »
    2 года назад, # ^ |
    Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

    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 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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

Spoiler
  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

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

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # |
Rev. 9   Проголосовать: нравится +6 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +17 Проголосовать: не нравится

    get two laptops

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +74 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

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 года назад, # ^ |
    Rev. 2   Проголосовать: нравится -8 Проголосовать: не нравится

    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 года назад, # ^ |
        Проголосовать: нравится -8 Проголосовать: не нравится

      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 года назад, # ^ |
          Проголосовать: нравится +18 Проголосовать: не нравится

        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 года назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    What operating system and version of Chrome are you using?

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

fst a2...

»
2 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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

»
2 года назад, # |
Rev. 2   Проголосовать: нравится -6 Проголосовать: не нравится

Resolved

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    because they will remove cheaters from the round firstly.

    • »
      »
      »
      2 года назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      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 года назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

        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 года назад, # ^ |
          Проголосовать: нравится +3 Проголосовать: не нравится

        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 года назад, # ^ |
            Проголосовать: нравится +13 Проголосовать: не нравится

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

»
2 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +29 Проголосовать: не нравится

    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 года назад, # |
Rev. 5   Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится -18 Проголосовать: не нравится

Worst problem quality I had ever seen.

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Also very weak sample tests

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 года назад, # ^ |
        Проголосовать: нравится +11 Проголосовать: не нравится

      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 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        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 года назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

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

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +19 Проголосовать: не нравится

    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 года назад, # ^ |
        Проголосовать: нравится +21 Проголосовать: не нравится

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

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится +6 Проголосовать: не нравится

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

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

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

      • »
        »
        »
        »
        2 года назад, # ^ |
          Проголосовать: нравится -20 Проголосовать: не нравится

        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 года назад, # ^ |
            Проголосовать: нравится +4 Проголосовать: не нравится

          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 года назад, # ^ |
        Проголосовать: нравится +3 Проголосовать: не нравится

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

»
2 года назад, # |
Rev. 2   Проголосовать: нравится +41 Проголосовать: не нравится

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.