Efficient Reinforcement Learning in Factored MDPs with Application to Constrained RL