有写了SAM然后WA8的同胞吗

P2743 [USACO5.1] 乐曲主题Musical Themes

@[linners](/space/show?uid=47981) +1 QAQ
by nosta @ 2019-01-12 12:32:58


写了后缀数组WA8的路过。。。
by duyi @ 2019-07-02 11:24:31


有...
by L_key @ 2019-08-21 10:06:59


@[linners](/space/show?uid=47981) 因为记录的是两数间的差值,二分check时要判断maxsa-minsa>mid,而不是>=。 ```cpp bool check(int x,int n) { int maxh=sa[1],minh=sa[1]; for(int i=2;i<=n;i++) { if(height[i]<x)maxh=minh=sa[i]; else { maxh=mymax(maxh,sa[i]); minh=mymin(minh,sa[i]); if(maxh-minh>=x)return true; } } return false; } ```
by L_key @ 2019-08-21 10:11:33


|