Kaneki_04's blog

By Kaneki_04, history, 7 years ago, In English

I had an assignment involving multi-threading and I was curious about what happens if I implement this here.

So, I ran this code to check if it was possible to reduce execution time.

At an input of N around 7*10^4 2 and 5 threads gave 6162ms while 9 threads gave 3478ms.

So by this logic isn't it possible to implement some brute force solutions via multi-threading?

This would defeat the purpose of competitive programming right?(It is certainly not efficient but someone can submit a brute force solution and get their solution accepted but one who couldn't think of an optimum method ends up losing points)

Edit:

Test 1

Test 2

Full text and comments »

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

By Kaneki_04, history, 7 years ago, In English

I have been trying to improve my knowledge on data structures and I started off with this blog.

I found the question mentioned in the blog quite interesting and was wondering if there were any other questions based on partial sums on codeforces..

Any help would be highly appreciated.

Thanks!!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Kaneki_04, history, 7 years ago, In English

Can someone tell me why custom test shows right answer but I WA??

Submission : 30314885

Link to image : Custom test

Full text and comments »

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

By Kaneki_04, history, 7 years ago, In English

I was thinking of a way to solve this problem in O(1) and I am not getting the right answer..

My logic was that..

the answer is (a+b)(a+1)(b+1)/2 and the equation is x+my=mc(I changed b to c for convinience..)

so upon applying the am>=gm inequality in the following way..

((a+b)+(a+1)+(2*m-1)(b+1)/3>=((2*m-1)^1/3)*answer

so answer would be floor(LHS/(2*m-1)^1/3) and LHS is (2*m*c+2*m)/3 as (a,b) lies on the line..

but I was getting a wrong answer..

Sorry if I missed something obvious and any help would be really appreciated..

Full text and comments »

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