Summary of errors on the eve of GDOI2018

Algorithms are error-prone

$FFT$

1. Pay attention to precision and whether to round

2. Note that the $complex$ class is not wrong, complex multiplication is like this:

complex operator *(const complex &b){return complex(x*b.x-y*b.y,x*b.y+y*b.x);}

splay

1. Pay attention to the writing of $get$

bool get(int pos){return ch[fa[pos]][1]==pos;}

2. Pay attention to the writing of son in rotate, do not write wrong

void rotate(int pos){
    int f=fa[pos],ff=fa[f],son=get(pos);
//  cout<<"rotate "<<pos<<ends<<f<<ends<<ff<<ends<<son<<ends<<ch[pos][son^1]<<ends<<ch[pos][son]<<endl;
    ch[f][son]=ch[pos][son^1];
    if(ch[f][son]) fa[ch[f][son]]=f;
    fa[f]=pos;ch[pos][son^1]=f;
    fa[pos]=ff;
    if(ff) ch[ff][ch[ff][1]==f]=pos;
//  cout<<"finish rotate "<<ch[pos][son^1]<<ends<<ch[f][son]<<ends<<ch[f][son^1]<<ends<<fa[f]<<endl;
    update(f);update(pos);
}

3. siz+1 during the execution of the insert function

Mo team

1. Note that the card is divided into blocks, such as 0.5, 0.6, 0.666666, 0.7 and so on.

2. Team Mo on the tree can merge add and del, and merge back and update (in fact, ordinary Mo team can also)

3. Mo team can really pass the data of $1e5$! ! !

$ KMP $

1. Pay attention to the meaning of $fail$: starting from 1, indicating the length

2. $getfail$ is better written as a function

3. Think of the $fail$ tree

$AC$ Automata

1. Pay attention to the writing of $getfail$! ! ! check carefully

2. When $dp$ is used, the array is reversed

3. All kinds of space are enough, including $bfs$ queue, $AC$ automaton this question, $dp$

4. If the direct violent $fail$ may be stuck, you can add the $vis$ mark, and then download the information

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324933573&siteId=291194637