md.ashif313's blog

By md.ashif313, 9 years ago, In English

Update 1 : The contest is over

Update 2 : Final standings can be found here

Google's hiring contest,APAC Kickstart 2017 Round D is going to held on Sunday, July 16, 2017 05:00 UTC – 08:00 UTC

 APAC Kickstart 2017 Round D

Ready to get started solving fun, challenging problems? Throughout the year, Code Jam hosts online Kickstart rounds to give students the opportunity to develop their coding skills, get acquainted with Code Jam’s competition arena, and potentially get noticed by Google recruiters, too. Participate in one—or join them all!

  • Vote: I like it
  • +31
  • Vote: I do not like it

| Write comment?
»
9 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

I can't find contest dashboard. Can someone give link to dashboard?

»
9 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Solutions will update here soon after the contest ends. https://github.com/ckcz123/codejam
Good Luck!

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Approach for B small? I tried to do kadane for k/n^2 elements for each dp state. Is this intended?

  • »
    »
    9 years ago, hide # ^ |
     
    Vote: I like it +4 Vote: I do not like it

    submatrix sum is product of Sum of A from (X1 .. X2) and Sum of B from (Y1 .. Y2) , Now suppose you have the list of all subarray sums of A and B , then you can binary search on answer. But notice we don't need all subarrays but only the ones with Max sums , Min Sums , just > 0 and just < 0 , so we can use a vector segtree to get these.

    • »
      »
      »
      9 years ago, hide # ^ |
       
      Vote: I like it +21 Vote: I do not like it

      No idea what you are talking about. T.T

    • »
      »
      »
      9 years ago, hide # ^ |
       
      Vote: I like it +5 Vote: I do not like it

      I guess you're talking about getting 10^5 maxsums, minsums, > 0 sums and < 0 sums. Am I right? How do i get these by vector segtree?

      • »
        »
        »
        »
        9 years ago, hide # ^ |
         
        Vote: I like it +9 Vote: I do not like it

        let sumi denote prefix sum from 1 to i , the max subarray sum ending at i is sumi-min(sumj for 0 <  = j <  = i - 1) , so we we keep a priority queue storing (Sum , Right endpoint , Range for left endpoint , Min element index) and using this when you pop the top element of priority queue , you can split the Range for left endpoints into 2 parts , (on the left of min element index and the right). This gives us the max subarray sums , the minsums part is also very similar. For > 0 sums instead of finding minimum subarray sum , we find the subarray sum just smaller than this (using vector segtree / persistent segtree) and do stuff similar to described above , Sums < 0 is very similar (Replace just smaller with just bigger).

  • »
    »
    9 years ago, hide # ^ |
     
    Vote: I like it +9 Vote: I do not like it

    Did a O(n^4) soln for getting all sub matrix sums. Also used a priority queue on the side for storing max K sums out of these

»
9 years ago, hide # |
 
Vote: I like it +34 Vote: I do not like it

I didn't want to derive the formula for closest distance of a point from a parabola and did some slow heuristics , took long enough to run but luckily i was able to submit with 2 seconds left.

  • »
    »
    9 years ago, hide # ^ |
     
    Vote: I like it +16 Vote: I do not like it

    I finished just two minutes after the contest ended. My solution is basically a Russian Nesting Doll equivalent of Binary/Ternary Search.

    Code

    • »
      »
      »
      9 years ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      I also solved C-small two minutes after contest, so sad(( I do binary search for radius and checking for intersection with point by going through parabola with low delta x.

      Code
»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I couldn't run my solution for B-small on VS-2015 because of too large array (~ 4*10^8), but it works fine on GNU C++. Is there any solution for creating large arrays in MS C++ ?

Code
  • »
    »
    9 years ago, hide # ^ |
    Rev. 2  
    Vote: I like it +5 Vote: I do not like it

    You shouldn't remember all the sums. However, remember only the largest K (~10^5) sums is enough.

    • »
      »
      »
      9 years ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

      Thanks, I know this. But question generally is about creating large arrays, not especially problem B-small:)

      UPD Solved, It's enough switch build mode to x64 to create large arrays (up to MaxInt bytes)!

      code
»
9 years ago, hide # |
Rev. 2  
Vote: I like it +4 Vote: I do not like it

I couldn't get AC on B small due to one stupid bug. Nevertheless, here's my solution for which I got AC now. First we find all the subarrays sums for A and B. Now, we sort them, let's call them X and Y. And make a max-heap for the maximum product. So, in the starting we insert in the heap, and X[size - 1]·Y[size - 1] (this is because max. product is either the product of two largest positive numbers or two smallest negative numbers). We keep track of the current indices which are there, let's say they are i, j then we insert in the heap, product of these elements (i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1). Overall complexity of solution is

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Is there a greedy approach for A ?

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve A large ? I solved A small using memoization .

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

how to solve B-large

»
9 years ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

I look through scoreboard and it looks like that more than 90% contestants from China & India. Why is so low number european contestants?

»
9 years ago, hide # |
 
Vote: I like it +26 Vote: I do not like it
»
9 years ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Was anyone contacted by recruiters? If so, what is your contest results?)

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

In problem B , how is the claim that we need to have only k largest sub array sums true.

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Has the recruitment through Kickstart 2017 Round D started ? If not , till when will it start ?