silverfish's blog

By silverfish, history, 2 years ago, In English

Hello to all the wonderful people here on codeforces!

I was first introduced to competetive programming two years ago, and as for many others, it became one of my favourite hobbies. When I was starting out, I rember RomeoFantastik's great videos after almost every codeforces round. Now that I've gained some experiance, I thought that I'll try and give back to the community (and also improve my explaining skills), by making video editorials and educational blogs for codeforces problems and contests. Please send me feedback!

Here's my first attempt, I try explaining A-C of todays codeforces round: CodeTON Round 1: A-C problems explained

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

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

you were just able to solve 3?

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

    My solution for D failed system tests unfortunately:((

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

      ooh! i never knew that that could also happen

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

        Same, int overflow for me (because 1<<32 == 0).

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

          I still haven't found where my solution goes wrong, surprising that it passed pretests at all.

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

            You got the wrong answer on testcase 8 same as me. Your k came out as 4294967296 but k*(k-1)/2 is more than n which should have invalidated the if condition but it didn't and your program output it resulting in WA.

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

              Damn, I didn't notice that k*(k-1)/2 can overflow long long. Got AC by adding one more condition.

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

          Exactly what happened with me as well. I think if the constraints of the problem had been a little lower then it would have avoided overflow without sacrificing the gist/trick of the problem.

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

            I think it's a little disappointing too because if you look at the case that fails me (probably "us" more generally), it has just one case, so it looks like coordinators saw it coming and it easily could have been added to hidden pretests.

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

              Might as well take this as a lesson for the future. I am pretty sure I am not gonna be making an overflow mistake like this in near future, it cost me an AC.

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

            I 100% agree that it should've been in the pretests. However, you can't make the argument of "make the constrainst a little lower" — otherwise, naive factorization would work ($$$OT\sqrt{MX})$$$, where $$$MX$$$ is maximum value.

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

              That approach didn't come to my mind. Yes this test case should be in the pretest rather than system tests.

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

      same here , overflowed occured bcz i was computing (c*(c+1))/2 when c was order of 1e18 ಥ╭╮ಥ from getting +105 predicted delta to +25 , its painful

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

Best wishes man

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

Great initiative, Good Luck.