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

Автор SarvagyaAgarwal, история, 8 лет назад, По-английски
  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

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

Why is the problemset page blocked ?
EDIT : Resolved :D

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

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

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

Would there be no contests for another 2 weeks ?

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

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

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

http://www.spoj.com/problems/VPALIN/
How can Knuth-Morris-Pratt Algorithm (KMP) be used here ?

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

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

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

Problem Statement:
On the eve of New Year in Dholakpur, Chota Bheem and Chutki are playing a game, described as follows.

There are two plates full of Laddus. Both can eat L (L>=1) laddus from any one plate or L laddus from both the plates in each step. They play the game alternatively and the last one to eat the laddu will be the winner.

As Chota Bheem wants to impress Chutki, he wants to make Chutki the winner. You have to help Chota Bheem in deciding who should play first.

Constraints:
1 <= Test cases(T) <= 105
0 <= a,b <= 106

As i could only come up with an O(TN2) approach which used O(N2) space(where N is max(a,b)), I wrote a brute force to see if any pattern existed but failed to find one.
What am i missing here ?
Thanks!
P.S : You can find the problem statement here.

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

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