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

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

Throughout the year, Google Code Jam hosts online Kickstart rounds to give participants the opportunity to develop their coding skills, get acquainted with Code Jam’s competition arena, and get a glimpse into the programming skills needed for a technical career at Google.

Each Kickstart round gives participants 3 hours to solve challenging, algorithmic problems developed by Google engineers. Participating is a fun way to grow your coding skills—and potentially explore opportunities at Google.

Inviting you to solve some fun and interesting problems on Sunday, May 27, 2018 05:00 UTC.

Dashboard can be accessed here during the contest. Problem analysis will be published soon after the contest.

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

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

I think the date should be May 27, 2018!

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

How to solve C-large?

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

    Count the contribution of each A[i] in the final answer.

    Consider the contribution of each A[i] in Powerm. It is .

    Then total contribution of A[i] is .

    Call the double summation as B[i]. Then . The second term is sum of a geometric progression. Hence, complexity is O(n).

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

Is there a solution better than brute force for B ?

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

When contest analysis will be online ?

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

What is the solution of B ?

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

    You can pick a set of sticks iff every pair of sticks does not meet. This gives the number of possible stick sets (without considering the convex polygon part) at most (15!)/(2^7 * 7!), which is about 2 million.

    Now just backtrack and try every possible stick sets. The convex polygon part can be solved using triangle inequality.

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

      Could you please explain how you arrived at that expression (15!)/(2^7 * 7!)

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

        Each stick can be thought of as a corresponding to precisely one pair of points. Since we want the sticks not to intersect, this means the pairs must be distinct.

        How many ways can we choose 7 distinct pairs from 15 vertices?
        Choose the first pair, that can be done in 15C2 ways, then from the remaining 13, choose another 2, and so on. Multiplying these out, we get 15!/(2!)^7.

        But note that the order of the 7 pairs themselves does not matter, so we have to divide by 7!.
        Hope that helped.

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

          Now that I think about it, the number of possible stick sets isn't bounded above by the said number, but the number of possible stick sets with size 7 is bounded by that number. Anyway, working with similar bounds shows that this approach can pass easily.

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

You can read about the author's analysis here. Sorry for the delay, we have been busy with regular work.