N-queens decorator with linear penalty function