Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Автор raja1999, 5 лет назад, По-английски

Greetings Codeforces Community!

CodeChef invites you all to join us at CodeChef’s monthly serving of the Cookoff. A 2.5 hours contest with five servings of challenging problems for you and your peers to relish. Crafted out of the very best ideas, our set of curated problems will take your codebuds on a delightful trip.

Further, the February Cookoff will be the perfect opportunity to give a boost to your CodeChef ratings and rankings. Meanwhile, you can also share with us some original and engaging problem ideas which can be used in CodeChef's future contests, here: www.codechef.com/problemsetting/new-ideas.

I hope you will participate with your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

  • Setters: teja349 (Teja Reddy), adarshagr8 (Adarsh Agrawal), fugazi ( Prashant Shishodia), codewiz (Nitish Gupta), taran_1407 (Taranpreet Singh), nagpaljatin1411 (Jatin Nagpal)
  • Editorialist: (Akash Bhalotia)
  • Tester: raja1999 (Raja Vardhan Reddy)
  • Statement Verifier: Xellos (Jakub Safin)
  • Admin: teja349 (Teja Reddy)
  • Mandarin Translator: qingczha (Qingchuan Zhang)
  • Vietnamese Translator: Team VNOI
  • Russian Translator: Mediocrity (Fedor Korobeinikov)
  • Bengali Translator: solaimanope (Mohammad Solaiman)
  • Hindi Translator: Akash Shrivastava

Contest Details:

Time: 16th February 2020 (2130 hrs) to 16th February2020 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.

Good Luck!

Hope to see you participating!!

Happy Programming!!

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

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

Bump. Contest starts in 10 minutes.

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

How to solve cyclesum. Div1 B.

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

Regarding the last problem, what's the complexity of finding the next largest element for each index of an array, using path compression?

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

    $$$O(n)$$$ with a stack, while the top is <= x pop, then top is the next largest element and push x to the stack.

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

      Yeah, that's what I implemented as well, but the path compression version is quite elegant, I am curious what it's complexity is. My guess is n log (n).

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

        What do you mean by path compression ?

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

          Here is one variant — Suppose you denote the original array as a[] and the required array as nxt[]. To find nxt[i], start with cur = i + 1 and keep doing cur = nxt[cur], until you find cur such that a[cur] > a[i] and set nxt[i] = cur.

          This is likely just DSU, as was pointed out in another comment.

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

    It's the same as dsu, you can also use union by size to make it "faster".

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

Did anyone notice that the handle for one of the setters isn't provided? Well here it is! codewiz(Nitish Gupta).

Edit : Thanks raja1999 for the update and sorry for the trouble.