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

Автор Kuber, история, 23 месяца назад, По-английски

I'm stuck in test case #10 in D. The test case has n = 20000. Is there a way I can see the complete test case?

I'd be thankful if someone can review my solution: https://mirror.codeforces.com/contest/1272/submission/166760372

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

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

I am not sure if seeing it will help you out in some way, but basically you can output the vector for example saying if the first number == 33125630.

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

    From testcase #5 onwards, the values are in the range of 10^7 — 10^9 and n is 20000. I feel, I am probably missing some edge case. I have been thinking about it for two days. I am unable to see. I have seen solutions from the editorial as well as top rankers from the contest. They have slightly different implementation which is clearer than my solution. However, I'm not over invested in my solution and really want case I'm. missing.

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

      N is 200000.

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

        Yes. Sorry. N is 200000 from testcase#5 onwards.

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

          Any reason behind doing space optimized solution?

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

            I did not think about it as dp at all. I just thought that to calculate the answer I don't need more than 3 values at once. It is a coincidence that the solution is a space optimized dp.

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

              Does s denote a max with 1 deleted element and f with all consecutive elements?

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

                Yes

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

                  Last else if states that v3 > v1, but if it is less then all variables reset to 0/1. Consider the case when v3 <= v1, but v2 > v1.

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

                  I am actually not quite sure if we can consider such case having only 3 variables. I'll try once more in a bit, but I might assume it either needs a bit more of variables or is impossible.

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

                  Nope, I can't find a way to solve it using 5 variables only.

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

Take a look at Ticket 15977 from CF Stress for a counter example.