摘要: 列主元GaussJordan消元法 struct Matrix { static const int MAXN = 505; static const int MAXM = 505; int n, m; long double A[MAXN][MAXM]; long double x[MAXM]; 阅读全文
posted @ 2021-01-02 19:35 purinliang 阅读(807) 评论(0) 推荐(0) 编辑
摘要: 使用方法 使用下列代码定义一个以seed为伪随机数种子的uint32范围内的伪随机数生成器: mt19937 rnd(seed); 定义完成后,使用下列代码生成若干个uint32范围内的伪随机数,并将其赋值给uint32类型变量r0, r1, r2, r3,它们极大概率互不相同: mt19937 r 阅读全文
posted @ 2021-01-01 01:53 purinliang 阅读(4192) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; #define ls ch[id][0] #define rs ch[id][1] const int INF = 1e9; const int MAXN = 100 阅读全文
posted @ 2020-12-31 17:33 purinliang 阅读(67) 评论(0) 推荐(0) 编辑
摘要: ll fac[18]; int n, k, c; int last[18]; void show() { printf("k=%d\n", k); for(int i = 1; i <= c; ++i) printf("%d%c", last[i], " \n"[i == c]); } void S 阅读全文
posted @ 2020-12-29 14:04 purinliang 阅读(236) 评论(0) 推荐(0) 编辑
摘要: int dis[200005]; int fa[200005][20]; void dfslca(int u, int p) { dis[u] = dis[p] + 1; fa[u][0] = p; for(int i = 1; i < 20; ++i) fa[u][i] = fa[fa[u][i 阅读全文
posted @ 2020-12-16 01:19 purinliang 阅读(77) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define debug(a) cout << #a << ": " << a << endl #defi 阅读全文
posted @ 2020-12-14 22:31 purinliang 阅读(67) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/2/problem/C 随机移动算法。 double x[4], y[4], r[4]; double dis(double X, double Y, int id) { double len = sqrt(sq(X - x[id]) + 阅读全文
posted @ 2020-12-14 20:28 purinliang 阅读(382) 评论(0) 推荐(0) 编辑
摘要: stack<int> S; vector<int> circle; int dep[100005]; void dfs(int u, int p, int d) { dep[u] = d; if(!circle.empty()) return; //printf("u=%d\n", u); vis[ 阅读全文
posted @ 2020-12-12 19:27 purinliang 阅读(166) 评论(0) 推荐(0) 编辑
摘要: struct SAM { static const int MAXN = 1e6 + 10; int nxt[2 * MAXN][26]; int len[2 * MAXN]; int lnk[2 * MAXN]; int cnt[2 * MAXN]; int siz; int lst; void 阅读全文
posted @ 2020-12-10 16:58 purinliang 阅读(77) 评论(0) 推荐(0) 编辑
摘要: struct BigInt { static const int BASE = 1000000000; static const int DLEN = 9; int len; vector<int> a; BigInt(int v = 0) { len = 0, a.resize(2); do { 阅读全文
posted @ 2020-12-09 02:28 purinliang 阅读(77) 评论(0) 推荐(0) 编辑