Pivotal Variable Detection of the Covariance Matrix and Its Application to High-Dimensional Factor Models