不是你官方数据怎么这么菜啊
显然,题解的做法复杂度是 O(∑ans) 的,可以轻松的卡到 O(n2)。
gen 如下:
#include <fstream>
using namespace std;
ofstream cout( "tmp.in" );
int main()
{
int n, q;
n = q = 1e5;
cout << n << ' ' << q << endl;
for ( int i = 1; i <= n; i++ )
{
cout << i << ' ';
}
cout << endl;
while ( q-- )
{
cout << n << ' ' << n << endl;
}
}