ananth94's blog

By ananth94, history, 6 years ago, In English

I've been trying to solve this problem — 385C - Bear and Prime Numbers , Bear and Prime Numbers. My solution gives a completely expected runtime error on Testcase#4. Can someone please explain to me as to why this is happening?

My solution: http://codeforces.com/contest/385/submission/12629174

Any help would be greatly appreciated.

Thanks in advance.

EDIT: Solved. I had not taken into consideration that even l could be greater than 10000000.

Read more »

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

By ananth94, history, 6 years ago, In English

Hello Codeforces community! I recently took part in the July 2015 long challenge on www.codechef.com . There was a problem called Masterchef( Problem code: MCHEF). I used a multiset as a priority queue to calculate the minimum cost for each dish. In the author's solution, they used a set instead of a multiset. The complexities are the same but my solution TLEs for the second subtask. Could someone please help me out here?

This is my solution: https://www.codechef.com/viewsolution/7352429 This is the editorial: http://discuss.codechef.com/questions/71856/mchef-editorial

Thanks in advance.

Read more »

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