~~卡常没有前途,写 BIT 吧~~
by myee @ 2021-10-04 15:48:43
我试一下卡常
by FuncoF9 @ 2021-10-04 16:19:20
```cpp
for(;j+8<r;j+=8){
ans[i]+=ppre[j]<l&&pre[j]>=l;
ans[i]+=ppre[j+1]<l&&pre[j+1]>=l;
ans[i]+=ppre[j+2]<l&&pre[j+2]>=l;
ans[i]+=ppre[j+3]<l&&pre[j+3]>=l;
ans[i]+=ppre[j+4]<l&&pre[j+4]>=l;
ans[i]+=ppre[j+5]<l&&pre[j+5]>=l;
ans[i]+=ppre[j+6]<l&&pre[j+6]>=l;
ans[i]+=ppre[j+7]<l&&pre[j+7]>=l;
}
```
这样卡效果不明显
你要
```cpp
int ans1,ans2,ans3,ans4 ....
ans1=ppre[i]
ans2=ppre[i+1]
....
ans[i]=ans1+ans2+ans3+ans4...
```
@[peterwuyihong](/user/100325)
by Isshiki·Iroha @ 2021-10-17 18:49:24
@[Isshiki·Iroha](/user/414386) 不,其实都试过了,从挑战右转过来的/流泪
by peterwuyihong @ 2021-10-17 18:53:24
尝试了一万次卡常,还是 2.1s...... QAQ
by Mogeko @ 2021-10-26 18:28:17
建议排序改成基数排序,估计就卡过了。
by Mogeko @ 2021-10-26 18:36:34
@[Mogeko](/user/119316) 基于比较的排序怎么改成基排啊![](//图.tk/r)
by peterwuyihong @ 2021-11-08 15:37:48