Quantum distance-based classifier with distributed knowledge and state recycling