跳到正文

科技·工程

模板 templates

喵仔牛奶约 3 分钟
原文
文章信息与版本

文章信息

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

版本

  1. v1当前

有需要自取,不保证正确性。

  • 源文件缺省源
C++
#include <bits/stdc++.h>
#define REP(i, l, r) for (int i = (l); i <= (r); ++ i)
#define DEP(i, r, l) for (int i = (r); i >= (l); -- i)
#define fi first
#define se second
#define pb emplace_back
#define mems(x, v) memset((x), (v), sizeof(x))
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define ppc(x) __builtin_popcount(x)
using namespace std;
namespace Milkcat {
	typedef long long LL;
	typedef pair<LL, LL> pii;
	const int N = 1e6 + 5;
	int main() {
		
		return 0;
	}
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	int T = 1;
	while (T --) Milkcat::main();
	return 0;
}
  • 图
C++
struct Graph {
	struct edge { int from, to, next; LL w; } e[N]; int cnt, n, head[N];
	void ins(int u, int v, LL w = 0) { e[++ cnt] = {u, v, head[u], w}, n = max({n, u, v}), head[u] = cnt; }
	void twi(int u, int v, LL w = 0) { ins(u, v, w), ins(v, u, w); }
	void clear() { for (int i = 1; i <= cnt; i ++) head[e[i].from] = 0; cnt = 0; }
	#define FEG(u, v, W, G, i) \
		for (LL i = G.head[u], v = G.e[i].to, W = G.e[i].w; i; i = G.e[i].next, v = G.e[i].to, W = G.e[i].w)
}

别人的:

原文
存档评论3 条抓取于