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

Автор Riyuzak251097, история, 4 года назад, По-английски

I recently came across an interesting problem You are given n cards numbered from 1 to N with 1 at the top and N at the bottom. You are supposed to remove elements alternatively from the deck with removing the first card and then push the next card at the bottom of the deck. The process stops when one card is left. Find the Number of the last card left. Can someone help me in getting the intuition in solving the problem above. I was required to solve it in less than O(n) time complexity.

Полный текст и комментарии »

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

Автор Riyuzak251097, история, 4 года назад, По-английски

I am trying to solve problem 1228 D. i had made a solution by traversing the edges of the graph and alloting elements to respective sets on basis of availability.. My solution did not get accepted for the case when i did not check for m != s1*s2 + s2*s3 + s1*s3 where s1,s2,s3 represent sizes of the sets.. can someone tell me why i need to check this condition and tell me the case where my solution fails if i dont check this condition

Accepted

Wrong Answer on TC 12

Полный текст и комментарии »

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

Автор Riyuzak251097, история, 4 года назад, По-английски

I was solving Problem 777D .. i had submitted my code for the problem but it gives runtime error for test case 5. The error occurs in case the input has only 1 string.. i handled the case for n = 1 and it worked. But still curious to find why my initial code did not work and gave a runtime error as when i ran test case 5 on my local machine and on online ide's they did not show runtime error.

Полный текст и комментарии »

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

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

Hi everyone. I am facing difficulty in understanding the editorial for the third question asked in Hackerearth October easy challenge 2018. It would be very helpful if someone tells me how to approach this problem and suggest where problems similar to this can be found

Link for the Question

Полный текст и комментарии »

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

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

Hi everyone, i am trying to implement the solution for 1029D which was asked in last div3 contest. I am failing at test case number 17. Can someone tell me what mistake i am making and rectify my code?this is my solution It would be really helpful if one can also guide me how to find similar questions of this type.

Полный текст и комментарии »

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

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

Given an array of n integers (1<=n<=300000, 0<=arr[i]<=100000) and q queries (1<=q<=300000) where each query contains 2 integers l and r (1<=l<=r<=n), tell the gcd of all the elements in range l to r (both inclusive).

I am just not getting an idea on how to link query(l) and query(r) in fenwick tree(BIT)

Полный текст и комментарии »

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

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

hi everyone, i have been lately solving lots of problems on codeforces and frequently giving contests. I found that i am able to solve A and B problems regularly in a contest and also solved the a2oj ladder. In case of C problems i am facing big difficulty as in most of them i am not able to think like the way of the solution, i am regularly practicing on a20j in div2 c category but still i am not able to think and have to see the solution. This is becoming kind of a habit with around 1 getting solved out of 5. Just wanted to know am i following the right path?

Полный текст и комментарии »

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