Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

rahulpadhy's blog

By rahulpadhy, history, 8 years ago, In English

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

Full text and comments »

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

By rahulpadhy, history, 8 years ago, In English

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..

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it

By rahulpadhy, history, 8 years ago, In English

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

Full text and comments »

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

By rahulpadhy, history, 8 years ago, In English

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..

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

By rahulpadhy, history, 8 years ago, In English

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/

Full text and comments »

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

By rahulpadhy, history, 8 years ago, In English

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

Full text and comments »

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

By rahulpadhy, history, 9 years ago, In English

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 ?

Full text and comments »

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

By rahulpadhy, history, 9 years ago, In English

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

Full text and comments »

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

By rahulpadhy, history, 9 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it