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

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

I need some help in this problem. I think that my approach is correct, but I am getting WA unfortunately. Please do help..

Here's the link to the question: http://www.spoj.com/problems/CATM/

My approach is as follows :

  1. If the mouse is at the edge of the field,i.e., if its x-co-ordinate=1 or n and if its y-co-ordinate=1 or m, then it can escape.

  2. If both the cats and the mouse lie in a diagonal(either left diagonal or right diagonal) with the mouse in the middle, then the mouse can't escape.

  3. For any other condition, the mouse can escape.

Here's the link to my solution : http://ideone.com/exE3j3

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

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

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

Hey, can anyone please tell as to where I am going wrong ? Here's the problem link : http://www.spoj.com/problems/PHONELST/

I am getting Runtime Error.. Am I doing anything wrong in the deletion part, wherein I am trying to delete the entire trie ? I am even getting Runtime Error for the 2nd sample input..

My solution link : http://ideone.com/4hSjtb

EDIT : My code seems to work for only a single test case, not for multiple test cases..

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

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

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

Can anyone please explain the approach to this question ? The editorial is not clear.. If possible, can you mention about any other approach ? Here's the link: https://www.hackerrank.com/contests/hourrank-14/challenges/clues-on-a-binary-path

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

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

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

Can anyone please explain about the concepts used in this question ?

https://www.hackerearth.com/practice/algorithms/graphs/graph-representation/practice-problems/approximate/graph-coloring/

I read about complete graphs and bipartite graphs from wikipedia(by seeing the comments), but still can't undertand how to approach this question..

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

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

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

Can anyone tell me how to approach this question ? I have been trying it for quite sometime now, but to no avail.. The link to the question is : http://www.spoj.com/problems/EASYFACT/

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

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

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

I am stuck in this SPOJ question. Can anyone please point out as to where I am going wrong ? I am not even getting the sample test cases correct..

Here's the link to the question :

http://www.spoj.com/problems/ADDAP/

And here's my solution for it. I am using BFS to detect the level of the nodes(I am pushing -1 into the queue after completion of each level & -1 here detects the completion of a level), but unfortunately not getting the correct answer.

http://pastebin.com/WnfkQXXH

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

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

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

I have been trying out this two-pointers question for a very long time. http://www.spoj.com/problems/KOIREP/ But I haven't been able to implement it. I referred to the following Topcoder thread : http://apps.topcoder.com/forums/;jsessionid=85746DDEA3A3E514D06E169F530987BD?module=Thread&threadID=760646&start=0&mc=5#1598832

But my main problem is that I haven't been able to implement it. Can anyone please help me with this 1 ?

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

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

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

Hi, I am new to segment trees. I am getting RE for this SPOJ question and I am unable to find out the mistake in my code. So, can you guys please help ?? Here's the link to the question... http://www.spoj.com/problems/GSS1/

And, here's my solution.. http://pastebin.com/dtKe4rx4

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

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

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

I am trying to find out the euler-totient values for all integers upto 10 ^ 5. However, I am getting terrible outputs for the below code, Can anyone please suggest me as to where am I going wrong ? Thanks in advance. :) Here's the link to my code. http://codepad.org/hexai2nk

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

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