告诫后人
查看原帖
告诫后人
552165
ComplexPlanck楼主2022/8/4 21:20

RT ,如果你把两个临时数组的top\,top\,设成全局变量,如:

topl = topr = 0;
// they're global varieties.
		for (int i = ldom; i <= rdom; ++ i)
		{
			ll temp = 0;
			for (int j = head[p[i].id]; j != -1; j = nxt[j])
			{
				if (temp > p[i].p) break;
				temp += t.ask(to[j]);
				temp += t.ask(to[j] + m);
			}
			if (temp >= p[i].p) ++ topl, tmpl[topl] = p[i];
			else p[i].p -= temp, ++ topr, tmpr[topr] = p[i];
		}

那么你会在递归的时候改变topl\,topl\,的值,然后造成一些莫名其妙的错误,并因此 WA/TLE

2022/8/4 21:20
加载中...