随笔分类 -  基础算法

摘要:异或的性质 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n; int a[N]; void solve() { cin >> n; for 阅读全文
posted @ 2022-08-14 17:12 wKingYu 阅读(22) 评论(0) 推荐(0) 编辑
摘要:递推 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 100 + 10; int n, m; int a[N][N], g[N][N]; int dx[] = {0, -1 阅读全文
posted @ 2022-08-10 14:06 wKingYu 阅读(25) 评论(0) 推荐(0) 编辑
摘要:二分 + BFS 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 20000 + 10; int n, m; int h[N], e[N], ne[N], w[N], id 阅读全文
posted @ 2022-08-05 23:38 wKingYu 阅读(17) 评论(0) 推荐(0) 编辑
摘要:差分 + 贪心 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e5 + 10; int n; int a[N], b[N]; void solve() { cin >> 阅读全文
posted @ 2022-07-23 18:16 wKingYu 阅读(20) 评论(0) 推荐(0) 编辑
摘要:位运算 大数乘法 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 5e5 + 10; LL a, b, p; void solve() { cin >> a >> b >> 阅读全文
posted @ 2022-07-21 18:18 wKingYu 阅读(16) 评论(0) 推荐(0) 编辑
摘要:递推 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e5 + 10; char a[10][10]; char g[10][10]; int dx[] = {0, -1 阅读全文
posted @ 2022-07-11 23:22 wKingYu 阅读(31) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 10; int n, m; int x[N], t[N]; vector<int> a, b, c; int f 阅读全文
posted @ 2022-06-27 14:19 wKingYu 阅读(32) 评论(0) 推荐(0) 编辑
摘要:等价变形 + 前缀和 + 单调栈 + 二分 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, res; int a[N]; LL s[N]; 阅读全文
posted @ 2022-06-26 15:11 wKingYu 阅读(12) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<vector> #include<algorithm> using namespace std; typedef pair<int, int> PII; vector<PII> segs; void merge(vector<PI 阅读全文
posted @ 2022-04-27 22:44 wKingYu 阅读(55) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<vector> #include<algorithm> using namespace std; typedef pair<int, int> PII; const int N = 3e5 + 10; vector<int> al 阅读全文
posted @ 2022-04-27 21:49 wKingYu 阅读(26) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; int lowbit(int x) { return x & -x; } int main() { int n; scanf("%d", &n); while (n --) { int x; scanf(" 阅读全文
posted @ 2022-04-27 16:57 wKingYu 阅读(23) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int a[N], b[N]; int main() { int n, m; scanf("%d %d", &n, &m); for (int i = 0; 阅读全文
posted @ 2022-04-27 16:30 wKingYu 阅读(11) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int a[N], b[N]; int main() { int n, m, x; scanf("%d %d %d", &n, &m, &x); for (i 阅读全文
posted @ 2022-04-27 16:15 wKingYu 阅读(21) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int a[N], s[N]; int main() { int n, res = 0; scanf("%d", &n); for (int i = 0; i 阅读全文
posted @ 2022-04-27 15:53 wKingYu 阅读(24) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 1e3 + 10; int a[N][N], b[N][N]; void insert(int x1, int y1, int x2, int y2, int c) { b[x1 阅读全文
posted @ 2022-04-26 22:10 wKingYu 阅读(22) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int a[N], b[N]; void insert(int l, int r, int c) { b[l] += c; b[r + 1] -= c; } 阅读全文
posted @ 2022-04-26 21:39 wKingYu 阅读(19) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 1e3 + 10; int a[N][N], s[N][N]; int main() { int n, m, q; scanf("%d %d %d", &n, &m, &q); 阅读全文
posted @ 2022-04-26 21:10 wKingYu 阅读(24) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int a[N], s[N]; int main() { int n, m; scanf("%d %d", &n, &m); for (int i = 1; 阅读全文
posted @ 2022-04-26 20:31 wKingYu 阅读(17) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<vector> #include<algorithm> using namespace std; vector<int> div(vector<int>& A, int b, int &r) { vector<int> C; fo 阅读全文
posted @ 2022-04-25 21:57 wKingYu 阅读(21) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<vector> using namespace std; vector<int> mul(vector<int>& A, int b) { vector<int> C; int t = 0; for (int i = 0; i < 阅读全文
posted @ 2022-04-25 21:21 wKingYu 阅读(18) 评论(0) 推荐(0) 编辑

欢迎阅读『基础算法』
点击右上角即可分享
微信分享提示