Getting WA for UVa 10461 — Difference

Revision en1, by madlad, 2019-07-15 13:22:49

I was trying to solve this problem: https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1402

I used simple BFS to solve the problem but I am getting WA.

My code: https://ideone.com/ljuSH7

There are no test cases for this on uDebug too and I am struggling to find out where I went wrong.

I just calculated the min time = time needed to complete all the jobs that need to be completed before 'x' and the max time = Total time — the time needed to complete all the jobs that require 'x' to be completed first and then I just calculated the difference of it.

Can someone help me?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English madlad 2019-07-15 13:22:49 678 Initial revision (published)