如果你用了莫队,WA 0pts
查看原帖
如果你用了莫队,WA 0pts
538609
Neutralized楼主2021/12/4 11:06

请检查您莫队主算法的运行顺序:

//cl: current left
//cr: current right
//lef: target left
//rig: target right

while(cl<lef)
	del(cl++);
while(cl>lef)
	add(--cl);
while(cr<rig)
	add(++cr);
while(cr>rig)
	del(cr--);

这样就WA 0pts\texttt{\color{red}WA \color{black}0pts},而这样:

while(cl>lef)
	add(--cl);
while(cr<rig)
	add(++cr);
while(cl<lef)
	del(cl++);
while(cr>rig)
	del(cr--);

AC 100pts\texttt{\color{green}AC \color{black}100pts}.
当然这是取决于您本身的adddel函数,也就是莫队的转移策略,如果改了还是WA不怪我

2021/12/4 11:06
加载中...