A.ElGamal's blog

By A.ElGamal, history, 9 years ago, In English

544D - Разрушение дорог for this problem I tried using Dijkstra and mark edges I used then I would loop on edges and count the number of unused edges then print them, but the problem is the following: 1)dijkstra gives me the "shortest" path where the problem needs that path does not exceed some fixed value so that I can delete more edges at the end 2)I can not handle the case when dijkstra select two ways for 1st and 2nd case that does not intersect (because it looks for shortest path) where it could increase the length of the path but decrease the number of used edges. any help would be appreciated

Full text and comments »

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

By A.ElGamal, 9 years ago, In English

20C - Dijkstra? in this problem , I used standard dijkstra using (visited) boolean array so as not to use a node as a source node twice , the problem is that code worked well until test 31(worst case) (WA:-1 although a path already existed) when I commented if condition saying not to re-visit a visited node the code was accepted ... I cannot understand why this happened .. any help is appreciated

Full text and comments »

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