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

Автор kostka, 3 года назад, По-английски

Whether you’re looking to practice your coding, prepare for an upcoming interview, connect with a global community, or have some fun — Kick Start is here to help! Round F 2021 starts in less than 24 hours on September 18 starting at 17:00 UTC. You will have 3 hours to solve what you can during the round.

We are excited to announce we are now supporting PyPy3 and updated compilers and interpreters for several languages. You can find more information in the Platform section of the FAQ.

Hope to see you in Round F 2021!

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

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

Good luck to everyone!

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

Can you postpone your contest?

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

Thanks for the pypy3 :)

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

So excited! It's the first time I get a perfect score and rank 102 (currently) in this contest.

I remember the first time I take part in kick start, in the round E of 2020, I only solved one problem and ranked 3868. Efforts have been made, and progress have been made.

Since I am applying for Google Software engineer developer this year, hope this contest can help me get an interview.

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

Is it me or the last two problems were harder than usual ?

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

Could someone pls post a clean code for C (star trap) ? I am not good at geometry.

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

    The analysis section is open now. You can read the editorial.

    Also after the contest you can view anyone's solutions.

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

    Here is my successful code.

    It's a similar idea to the editorial, with the following difference: when handling quadrilaterals, I place all points into equivalence classes by the gradient formed when joined to the blue star. In all classes where there are >= 2 stars, and they are on different 'sides' of the blue star (found by checking the signs of the x differences and y differences, I take the pair closest on either side and treat these as a 'candidate pair'. This candidate pair now forms 2 non-adjacent vertices of a potential quadrilateral (since we know that the blue star sits on the intersection of the lines formed by 2 such pairs). I then iterate over all pairs of 'candidate pairs', which gives me all combinations of 4 vertices.

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

    Here's my contest submission code

    I used a different idea then the analysis. I viewed the stars as vertices of a graph. I placed an edge from white star x to white star y, if the blue star was to the right of the line through x and y (I did this with a cross product check). The edges have weight equal to the distance between star x and y. If we find a cycle in this graph, it means we went completely around around the blue star, thus we made a polygon. So in this graph we have to find the minimum weight cycle. This can be done with Floyd-Warshall in O(n^3).

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

    Some edge cases that tripped my solution.

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

I wasted a lot of time on C trying to solve it by Jarvis March algorithm. I was completely incorrect with that.

Luckily I managed to solve D, got a half decent score.

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

    Can you explain you approach ( for the first half) for D! I read the editorial and yet not able to understand it.

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

      It is an obvious Bitmask DP problem.

      STATE

      We define the state as -> (mask,node) Where the mask has the ith bit set if that particular node's shield has been broken. We need to maintain the node variable along with the mask which means that this particular mask was the last node whose shield's was broken.

      TRANSITIONS

      We are traversing the graph in a connected fashion, so at any instant we can break the shield of a previously unvisited node if it is connected to any visited node and l <= pot <=R. Luckily we can traverse the entire adjacency list for this as it fits in the Time Constraints. Just make sure you don't count a particular transition multiple times(use a set to keep a track of that).

      BASE CASES

      If points > k return 0. If points == k return 1.

      My Code

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

I forgot to check if the submask was connected in my dp for problem D and yet passed test set 1.

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

My solution for C has time complexity $$$O(N^4)$$$ but still it passes. Maybe because of optimizations.

I think the worst case for this is around $$$(\frac{N}{4})^4$$$ operations so that's why, but I'm not sure.

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

    My solution for C also has time complexity $$$O(N^4)$$$ and I also was very surprised that it passed. I think that it may be hacked by the following testcase:

    Ruby script

    Basically place the blue star at x=1000 y=1000. So that it is in the center of a cross spanning 75 points up, 75 points down, 75 points left and 75 points right.

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

can someone share solution using multiset in problem B ?

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

Was that open for everyone?? , or only who cleared the previous rounds were eligible for this Round??

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

    kick start is unlike code jam, and each contest is independent. Everyone can register and participate, you don't need to do well in the previous round.

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

Anybody solved C with shortest path algorithm? I think it will be applicable even if we need to enclose a set of stars, rather than one.