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

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

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

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

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

you were just able to solve 3?

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

    My solution for D failed system tests unfortunately:((

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

      ooh! i never knew that that could also happen

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Best wishes man

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

Great initiative, Good Luck.