Stores the stations and respective rate of fuel
unordered_map < int , int > map ; for ( int i = 0 ; i < M ; i ++ ) { map [ 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 ) { cout << -1 ; return ; }