An exact algorithm for the min-cost network containment problem