Before revision:  In this paper, we propose an O(n^2 log nlog log n+nm log m)-time algorithm for any m, which improves the previous work even for m=1.
After revision:  In this paper, we propose an O(n^2 log nlog log n+nm \log m)-time algorithm for any m, which improves the previous work even for m=1.