electro177's blog

By electro177, history, 6 weeks ago, In English

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 //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

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

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

No one got?

»
6 weeks ago, # |
Rev. 4   Vote: I like it +1 Vote: I do not like it

Removed

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    This problem was asked in a hiring challenge, organized today (during the time this blog was made). I would suggest delaying discussion for a few hours.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The problem has been asked in a hiring challenge conducted today. The contest is live till 4.00PM IST, I would request everyone to wait for a few hours before discussing any type of solution for this problem.