Minimax Optimality in Contextual Dynamic Pricing with General Valuation Models