Stores the stations and respective rate of fuel
var map = new Map ( ) ; for ( var i = 0 ; i < M ; i ++ ) { map . set ( a [ i ] , b [ i ] ) ; if ( i == M - 1 && K < N - a [ i ] ) { flag = false ; break ; } else if ( i < M - 1 && K < a [ i + 1 ] - a [ i ] ) { flag = false ; break ; } } if ( ! flag ) { document . write ( - 1 ) ; return ; }