coding round problem..dijkstra?
Difference between en1 and en2, changed 117 character(s)
hello all↵

given n cities from 1 to n and m flights.each flight is represented as(L,R,c) which means flight starts from city L and end at R and the cost is c(one can travel between any two cities from lower index to larger ,both inclusive)with cost c↵
mathematically (l,r,c)--people can travel from u to v(l<=u<v<=r) at the cost c//not like our trains:)↵

find the minimum cost from city 1 to n,if not reachable o/p -1;↵

constraints:↵
n<=1e5

m<=1e5↵
1<=l<r<=n↵
c<=1e9;
  //number of cities↵
m<=1e5    /// number of flights↵
1<=l<r<=n  //for each flight starting and ending points↵
c<=1e9;   // cost for each flight



i tried to create an adjacency list but to update the list i did not get idea how to do that effectively?↵
bec it took (r-l)^2 for updating for each flight ,but that would tle

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English electro177 2021-10-23 11:05:30 117
en1 English electro177 2021-10-23 11:00:06 686 Initial revision (published)