the code: the cost array