Getting TLE in a graph based Div:2(D) Problem.

Revision en1, by NO..ONE..CARES, 2016-05-03 17:29:45

I am getting Time Limit Exceeded for that problem. If anyone can please help. Thanks in advance :)

My approach: By calling N times BFS i got all pairs shortest path. Then by recursively i took all possible 4 nodes as there is no sub-problems so only backtracking can handle this.

Problem Link: http://codeforces.com/contest/667/problem/D

My solution Link: http://codeforces.com/contest/667/submission/17699475

Tags graph, recursion

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English NO..ONE..CARES 2016-05-03 17:29:45 470 Initial revision (published)