第一题有O(n)的做法,见
https://loj.ac/problem/6191/statistics/fastest
(不过我不会)