Solving NP-hard problems with bistable polaritonic networks