One-Shot Resource Distillation in Quantum Resource Theories, and W-State Encoding for Optical QEC