跳到正文

个人记录

若只错误大赏

chm_qwq约 3 分钟
原文
文章信息与版本

文章信息

发布
2024年10月6日
收录
2025年12月12日
更新
2026年11月10日
篇幅
约 3 分钟
获赞
2

版本

  1. v1当前

1. P3384

C++
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

C++
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

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

《GCD写错》

4. 头文件

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

《空格》

4. 返回值

C++
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

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

《没有返回值类型》

原文
存档评论1 条抓取于