莫队算法简介

Mo's algorithm is an algorithm proposed by Mo Tao . Before him, the Mo's algorithm has been used in a small group on Codeforces, but Mo was the first person to ever summarize the algorithm in detail. When Mo proposed that algorithm, he only analyzed the ordinary version, but after the countless contributions from many OIers and ACMers, Mo's algorithm now has a variety of expanded versions.

The Mo's algorithm can solve a series of offline interval query problems and its applications are extremely wide. At the same time, it can be easily expanded to handle queries on tree paths and support modification operations.


评论