若只错误大赏

· · 个人记录

1. P3384

void pushdown (int p) {
    if (add(p) == 0) return;
    sum(p*2) += add(p) * (r(p*2) - l(p*2) + 1);
    sum(p*2+1) += add(p) * (r(p*2+1) - l(p*2+1) + 1);
    sum(p*2) %= mod;sum(p*2+1) %= mod;
    add(p*2) = add(p);// QAQ
    add(p*2+1) = add(p);// QAQ
    add(p) = 0;
}

《覆盖子节点 add》

2. P2146

void dfs1 (int p,int f) {
    hson[p] = -1;
    siz[p] = 1;
    fa[p] = f;
    dep[p] = dep[f] + 1;
    for (int i = head[p];i;i = e[i].next) {
        int np = e[i].to;
        if (np == f) continue;
        dfs1(np,p);
        siz[p] += siz[np];
        if (hson[np/*QAQ*/] == -1 || siz[np] > siz[hson[p]]) 
            hson[p] = np;
    }
}

《子节点的重儿子是否为空》

3. P2146

int Gcd (int a,int b) {
    return b?a:Gcd(a%b,b);
}//Wrong
int Gcd (int a,int b) {
    return b?Gcd(b,a%b):a;
}//Right

《GCD写错》

4. 头文件

#include <iostream>
#include <algorithm >
using namespace std;

《空格》

4. 返回值

int tarjan (int s) {
    dfn[s] = low[s] = ++tot;
    stack[++top] = s,ins[s] = 1;

    for (int i = head[s];i;i = edge[i].next) {
        int ns = edge[i].to;
        if (!dfn[ns]) {
            tarjan(ns);
            low[s] = min(low[s],low[ns]);
        }
        else if (ins[ns]) 
            low[s] = min(low[s],dfn[ns]);
    }
    if (dfn[s] == low[s]) {
        cnt++;
        do {
            ins[stack[top]] = 0;
            c[stack[top]] = cnt;
            scc[cnt].push_back(stack[top]);
        }while (s != stack[top--]);
    }
}

《return失窃案》

5. 不返回的inline

inline qwq () {
    cout<<"q";
    return ;
}

《没有返回值类型》