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

Автор shashank21j, история, 9 лет назад, По-английски

Hi coders

Sears is hosting its first ever online Hackathon on HackerRank- Sear Dots & Arrows with some really big prizes on offer. Register yourself now at https://www.hackerrank.com/sears-dots-arrows

The contest commences on Sunday, 23 October at 5PM IST, and remains open for 7 hours.

  • 1st prize — 400,000 INR
  • 2nd prize — 200,000 INR
  • 3rd prize — 100,000 INR
  • 4th to 15th — I Pad
  • 16th to 100 — 2,000 INR
  • 101 to 200 — 1,500 INR

Prizes are only for Indian programmers residing in India.

Please check out the contest page (https://www.hackerrank.com/sears-dots-arrows) for more details on the contest.

UPD Final leaderboard is generated. Congratulations to the winners.

GL & HF

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

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -13 Проголосовать: не нравится

12 ipads and  ≥  1500 bucks for the top 200. What. The. Fuck.

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

Will the prizes be given on the basis of online round ranklist or onsite ranklist?

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

Is the onsite event a Hackathon or a usual coding contest?

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

What is INR ?

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

how to apply for a Indian citizenship?

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

Can you please clarify what you mean by Hackathon? Normally hackathons are used to develop software, but then in the contest details page it is mentioned that "To power the same, Sears India invites coding talent from pan India to compete in a 2 tier 'algorithm intensive' programming Hackathon". Is it going to be an algorithmic programming contest similar to the first round or not?

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

What's the solution for Simple Paths?

I check if some color is included in the set by seeing the components made by edges that are of colours =/= that color offline. This only gets 83.33. WA on test case #6. Submission

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

Can somebody post their accepted code for D Connection Queries? I implemented Mo's Algorithm but the solution was giving TLE. I am using Mo's + Hashing.

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

How to solve connection queries?

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

    I solved Connection Queries using MO's Algorithm.

    Keep cnt[] array where cnt[i] = 1 if node i is present in the range [current_left(cl) , current_right(cr)].

    Lets say ,we have answer (ans) for [cl,cr] in mos algo.

    1. Explanation of add(): adding a node (a[i]) in the current range of nodes. if cnt[a[i]+1] == 1 and cnt[a[i]-1] == 1, then adding a[i] will join 2 components hence ans--. if cnt[a[i]+1] == 0 and cnt[a[i]-1] == 0, then adding a[i] will add 1 component which is single node (a[i]) hence ans++.

    2. Explanation of remove(): removing a node (a[i]) in the current range of nodes. if cnt[a[i]+1] == 1 and cnt[a[i]-1] == 1, then removing a[i] will break 1 component into 2 components hence ans++. if cnt[a[i]+1] == 0 and cnt[a[i]-1] == 0, then removing a[i] will remove 1 component which is single node (a[i]) hence ans--.

    Handle the cases when a[i] = 1 and a[i] = n in both the functions.

    My AC code using same Algorithm.

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

Can connection queries be solved using segment trees?

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

Can someone explain what sublist riddle wanted us to do? I'm still confused.

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

Approach for the last problem ?

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

    Use Matrix Multiply and make the Transform Matrix T, use Exponentiation by Squaring to get Bib(x) fast.

    Also Bib(x+y) = Bib(x) * T^y.

    List all the elements to add up S (assume N = 4), we get

    row_1 => Bib(A1),

    row_2 => Bib(A1+A2), Bib(A2)

    row_3 => Bib(A1+A2+A3), Bib(A2+A3), Bib(A3)

    row_4 => Bib(A1+A2+A3+A4), Bib(A2+A3+A4), Bib(A3+A4), Bib(A4)

    sum(row_2) = sum(row_1) * T^A2 + Bib(A2)

    sum(row_3) = sum(row_2) * T^A3 + Bib(A3)

    sum(row_4) = sum(row_3) * T^A4 + Bib(A4)

    Then sum all of them up to get S.

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

    Problem: https://www.hackerrank.com/contests/sears-dots-arrows/challenges/modified-fibonacci-1

    Algo: Matrix Expo.

    let the array elements be { a[1] , a[2] ... a[n] }.

    Then b(a[i]) = T^a[i]-1, where T is the transformation matrix.

    Now , all the sub-arrays ending at index i-1 will be.

    S1 = (a[1] + a[2] ... a[i-1])

    S2 = (a[2] + a[3] ... a[i-1])

    . .

    Si-2 = (a[i-2] + a[i-1])

    Si-1 = (a[i-1])

    Now, contribution of all the sub-arrays ending at i-1 will be,

    tans = b(S1) + b(S2) ... b(Si-1) = T^(a[1]+a[2] ....a[i-1]-1) + T^(a[2]+a[3]...a[i-1]-1) + ... T^(a[i-1]-1).

    now, the contribution of all the sub-arrays ending at i will be,

    T^(a[1]+..a[i]-1) + T^(a[2]+...a[i]-1) ... T^(a[i-1]+a[i]-1) + T^(a[i]-1)

    which is equal to,

    (tans * T + I) * T^(a[i]-1).

    My AC code using same Algorithm.

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

Can anyone provide some information about the timings and exact venue of the onsite contest?

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

Does anybody know when the onsite results will be announced?

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

How to solve "Cut into Palindromes" problem..??

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

Where can we see onsite problems ?

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

How to solve "greedy strategy"?

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

    TL DR: Brute-force — O(n^4): http://ideone.com/w3J7Lk

    Naive solution is obvious: While we can find a solution try all O(n^4) top-left and bottom-right vertices of submatrix, and take the best in each iteration. Since, there can be at most O(n^2) solutions the runtime is O(n^6) which gives 36 points.

    To optimize the above for 100 points, iterate on each O(n^4) submatrix only once. If we can check if to take this submatrix or not in O(1), we are done since we have an O(n^4) solution which fits the time limit.

    1). To check if to take A[x..c][y..d] or not in O(1) is simple — if we have calculated B[i][j] = number of ones in A[1..i][1..j], then check percentage condition by calculating number of ones in A[x..c][y..d] by the formula B[c][d]-B[x-1][d]-B[c][y-1]+B[x-1][y-1]. To update matrix B, note that it needs to be updated only when we choose a submatrix, so only O(n^2) time. So just rewrite whole B, first by making the chosen submatrix largely negative A[i][j] = -n*m-1 for all x<=i<=c and y<=j<=d. Then re-calculate whole B using B[i][j] = A[i][j] + A[i-1][j] + A[i][j-1] — A[i-1][j-1]. Number of ones will come negative in a submatrix if it overlaps with some other already chosen submatrix.

    2). The iteration order of submatrices is dictated in the question itself: take decreasing order of area, then all start points from (1,1) to (n,m) then increasing order of lengths which divide the area: You can code to iterate on each submatrix exactly once by using two pointers on lengths with fixed area(refer to above code).

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

did anyone get the reimbursement or prize money for the onsite ?

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

Did everyone get their prizes ??

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

I still haven't received my prize money. Will it ever come? :p

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -28 Проголосовать: не нравится

mdzz...........垃圾比赛,毁我青春

我怎么连E都不会做2333333

看不懂?辣鸡 translate