Doubt in SPOJ problem "The Last Shot"

Правка en1, от fight_back, 2017-09-24 05:09:53

Hi guys,

I was trying the problem http://www.spoj.com/problems/LASTSHOT/ using DFS and getting continuous WA. Here are two ways(with little difference) I tried https://ideone.com/zIFdC0(WA) and https://ideone.com/ipq4lw(TLE). Can anyone please say where am I possibly getting wrong ? And what can be a better(or faster) solution. How can this be done with DP , as mentioned in the comments ? Thanks, in advance. :)

HAPPY CODING! :)

Теги dfs and similar, graphs, #dp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский fight_back 2017-09-24 05:09:53 480 Initial revision (published)