Dragonado's blog

By Dragonado, 3 years ago, In English

ನಮಸ್ಕಾರ ಕೋಡ್‌ಫೋರ್ಸಸ್ (Hello Codeforces)!

We invite you to participate in CodeChef’s March Cook-Off, this Saturday, 5th March, rated for all.

Time: 8 PM — 10:30 PM IST. Note the new schedule.

Web3 giant Chingari is onboard to pick their recruits in the areas of Machine Learning, Rust and Web3.

These job openings are for Indians, and Non-Indians (who can work from home), and are experienced in any of the following: Rust, React, Golang,C/ C++, Python, Machine Learning, Deep Learning, Data Mining, Recommendation Systems etc. You’re also a desirable candidate if you have a deep understanding of the blockchain and cryptocurrency space and smart contract systems, specifically having a good understanding of Solana. The application for the openings are given in the Cook-Off contest landing page.

This edition of CookOff is part of the NITK annual CP contest called Inscription. We have many more tech events under our annual tech fast called Engineer 2022. You can check our events out here. Most of the problems of this contest were written by the undergraduate students of NITK ^_^

The contest will be 2.5 hours long. There will be 7 problems in Div 1/3 and 8 problems in Div 2/4. It will be rated for all four Divisions.

Joining me on the problem setting panel are:

Prizes:

  • Top 10 global Division One users will get $100 each.
  • Top 25 Indian Division One coders to get Amazon Vouchers worth Rs. 1500 each.

The video editorials of the problems will be available on our YouTube channel as soon as the contest ends. Subscribe to get notifications about our new editorials.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.

Hope to see you participating. Good Luck!

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

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

happy to participate now that codechef plagiarises copied codes

Fair competition

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

    Are you sarcastically accusing CodeChef of plagiarism?

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

unfortunately leetcode biweekly and march cook off at same time :'(

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

Reminder: Contest starts in 30 minutes.

»
3 years ago, # |
  Vote: I like it -85 Vote: I do not like it

Atcoder > Codeforces >> Leetcode >>>>>>> Codechef

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

    Why is Codechef hated? I'm not a usual participant but I find the problems interesting, which I think is enough to enjoy.

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

Screenshot-2022-03-05-212857

What is this judge's error?

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

After an hour thinking about NANDXOR, I just tried $$$O(n^4)$$$ brute force with $$$min(n, 100)$$$ without having convinced myself that a solution would be found, and it passed. I guess that's the intended solution but I feel like cheating for not being able to prove it.

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

    Hint: Pigeonhole principle.

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

      I noticed about the 30 possible values but I was confused about what would happen if two equal popcounts share an element of the array. It turns out we just need 62 elements so we have 31 non intersecting pairs. Thanks.

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

    [Deleted]

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

lmfao my code with random_shuffle() 100 times passed NANDXOR

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

    This is because there are only ~30 possible values of the number of set bits. So random shuffling gives you a 1/30 chance of finding a valid pair. The chance of finding it over 100 such attempts is: 1 — (29/30)^100 => 97%.

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

      Oh right, thanks for the explanation!

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

Can someone tell what is the 18th test case for NANDXOR? I tried to debug for almost two hrs, still not able to find the issue with the code.

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

Can someone tell why this code gives wrong answer? link.

Here I have used the logic that since popcount() can only give 32 values so it will always repeat after some fixed number of pairs and I am considering more than required amount in my interations I think.

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

    I think it might be because of outputting a trailing space after the fourth number. I had the exact same issue in the contest, with no idea what's wrong, and only after the contest I thought that maybe that could be the reason, and yeah: https://www.codechef.com/viewsolution/59771506 vs https://www.codechef.com/viewsolution/59771417

    Odd that the checker did not accept a trailing space, as it usually does on every platform :v

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

      I tried removing the extra space as well but it is still giving a WA when I submit it link.

      I have already spent quite a few hours on it but could not find the mistake :(

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it
        Input
        A possible output
        Your Output
        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Thanks a lot, finally I was able to understand my mistake.

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

My mistake in NANDXOR is I sorted the array and I didn't realize that :/ removing sort passed :/ :/

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

Thanks a lot for the contest, I really enjoyed it.

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

Okay, so are we just going to ignore the fact that checker for problem "Dragonado And XOR" seems to be broken? Trailing space casued WA for me, and I believe even on Codechef you ignore trailing spaces in all other problems by deafult? Even if not my "incorrect" submission gets WA only on testcase ~19 (not earlier), which is even stranger. Links to submissions (the only difference is putting trailing space everywhere in one of them): AC WA

Can someone elaborate? Dragonado

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

    I'm not entirely sure, but I believe CodeChef runs your code on all the testcase regardless of the verdict. so just because it says running test 19 doesn't mean the first 18 have gotten AC verdict. I've submitted completely invalid code and got it run on all the cases, but again, don't quote me on that one.

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

Ashishgup tabr very_slow For the problem "Dragonado And XOR" I was getting WA because I was printing space after the last printed integer.

Shouldn't this be taken care of by the checker?

AC: https://www.codechef.com/viewsolution/59774092

WA: https://www.codechef.com/viewsolution/59774089

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

    I faced a similar issue and took a lot of time to finally realize it. It should be explicitly mentioned if this was intended.

    Here is the link of my submission during the contest: https://www.codechef.com/viewsolution/59774459

    Here is the link to my submission after the contest: https://www.codechef.com/viewsolution/59774459

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

      I couldn't figure out this during the contest, though I doubted the checker and queried about the checker, and they replied checker was OK.

      It could have been an excellent contest for me, but got a negative delta instead :-/.

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

        CodeChef_admin Ashishgup nishant403 tabr
        Ig they have updated the checker and rejudged all the submissions and accordingly updated the ratings. But still, is it fine to do so? Like some users may have been trying it and wasted time on that NANDXOR problem, which if they could have got the AC verdict in one go, they may have solved the next problem as well. This was an issue from their side, so why don't make the round unrated for the users who are getting a negative delta just because of their mistake.

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

    Thanks a lot.

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

    You have taken max 15 for n, shouldn't we try max 62 for n?

    What was the logic?

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

      You only need to check 62 pairs, by taking the first 15 elements you can generate (15*14)/2=105 pairs.

      Edit: this is incorrect because we cant ensure pairs don't share an element.

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

        How do you know your pairs don't share an element? It is clear that having 62 elements you can get 31 pairs not sharing elements. I'm not sure about what you said though.

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

    I also faced the same issue and got 2 WAs before getting AC.

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

I think that the tests for Dragonado And XOR might be weak. My solution where I am checking only the first ten elements works.

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

    There are only 30 values possible. For the first 10 elements, you have approx 45 pairs.. so there is high chance 2 pairs might match.

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

The problem NANDXOR had an issue in the checker — participants outputting extra whitespaces were getting a WA instead of AC. The checker has been fixed, all non-AC submissions rejudged, and ratings recalculated. A total of 26 users across all divisions had at least one of their submission's verdict changed due to the rejudge, and we apologize for this mistake. Among those 26 affected participants, 8 users had their rating decrease for the contest, and that decrease has been reversed for them to have a net of +0 rating change in this contest. That is, the contest is unrated for those 8 participants. An email has been sent to all the 26 affected participants.

Apologies again for the issue.