Let p be an odd prime, s, m be positive integers, gamma, lambda be nonzero elements of the finite field F-pm such that (gamma)p(s) = A. In this paper, we show that, for any positive integer eta, the Hamming distances of all repeated-root lambda-constacyclic codes of length eta p(s) can be determined by those of certain simple-root gamma-constacyclic codes of length eta. Using this result, Hamming distances of all constacyclic codes of length 4p(s) are obtained. As an application, we identify all MDS lambda-constacyclic codes ...