追逐自由的小亮亮
追逐自由的小亮亮
全部文章
分类
归档
标签
去牛客网
登录
/
注册
追逐自由的小亮亮的博客
全部文章
(共15篇)
题解 | 【模板】静态区间最值
#include <bits/stdc++.h> using namespace std; const int MAXN=500005*2;//初始化双倍长度,便于区间合并。 int n,q,a[MAXN],logi[MAXN],maxi[20][MAXN],mini[20][MAXN]...
2026-04-14
1
19
题解 | 【模板】最近公共祖先(LCA)
#include <bits/stdc++.h> using namespace std; const int MAXN=500005; vector<int> adj[MAXN]; int fa[MAXN]; int depth[MAXN]; void bfs(int ro...
2026-04-13
2
25
题解 | 【模板】记忆化搜索
#include <bits/stdc++.h> using namespace std; long long f[102][102][102],mod=1e9+7; void fun1(){ for(int i=0;i<101;i++){ for(int ...
2026-04-13
1
19
题解 | 四则运算 逆波兰式(注意处理负号)
import java.util.*; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new S...
2026-03-25
1
21
题解 | 隐匿社交网络 并查集做法
import java.util.*; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { static class UnionFind{ int[] parent; int[] size; ...
2026-03-24
1
25
题解 | 小红的慕斯模具统计
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int N,X,K; cin>>N>>X>>K; vec...
2026-03-11
1
48
题解 | 两个队列实现栈
class Solution { public: void push(int element){ q1.push(element); while(!q2.empty()){ int tmp=q2.front(); ...
2025-04-07
1
88
题解 | 合并k个已排序的链表
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: /*...
2025-03-30
1
73
题解 | #实现二叉树先序,中序和后序遍历#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2024-08-24
1
155
题解 | #小红取数#
#include <iostream> #include <bits/stdc++.h> // 包含所有标准库 using namespace std; int main() { int n, k; // n 表示数组的大小,k 表示取模的值 long lo...
2024-08-24
1
245
首页
上一页
1
2
下一页
末页