chenlan114
chenlan114
全部文章
分类
题解(1)
归档
标签
去牛客网
登录
/
注册
chenlan114的博客
全部文章
(共74篇)
题解 | 树上行走
用 BFS 加并查集的办法来维护每个可以连通的区块来找到节点最多的连通块即可 #include<bits/stdc++.h> using namespace std; using ll=long long; const ll N=2e5+5; vector<vector<ll...
2026-04-04
0
6
题解 | 1=N
#include<bits/stdc++.h> using namespace std; using ll = long long; const ll N = 3e5; vector<ll> primes; // 存储筛出的所有质数 vector<b...
2026-04-03
0
10
题解 | 冥古之潮
#include<bits/stdc++.h> using namespace std; using ll = long long; const ll N = 1e6 + 5; const ll MOD = 1e9 + 7; vector<vector<ll>&g...
2026-04-01
0
10
题解 | 最大最小路
#include<bits/stdc++.h> using namespace std; using ll=long long; struct UF{ UF* root; ll rank=0; ll cnt=1; }; UF* Root(UF* a){ ...
2026-03-31
0
11
题解 | Forsaken喜欢数论
#include <iostream> #include <vector> using namespace std; using ll = long long; const ll N = 3e7; // 质数筛选最大范围 vector<ll> primes; ...
2026-03-28
0
13
题解 | 太阳之华
#include<bits/stdc++.h> using namespace std; using ll=long long; const ll N=2e3+5; vector<vector<char>>g; vector<vector<bool&g...
2026-03-24
0
19
题解 | 三视图
#include<bits/stdc++.h> using namespace std; using ll=long long; const ll N=1e3+5; bool vis1[N][N]; bool vis2[N][N]; bool vis3[N][N]; int main(...
2026-03-16
0
20
题解 | 显生之宙
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); ll T; ...
2026-03-13
0
23
题解 | 食物链计数
采用反向记忆化 DFS的思路,统计 DAG 上符合题目定义的食物链数量,核心逻辑如下:明确题目定义与代码的对应关系题目要求的食物链是:生产者(出度为0,起点) → 沿有向边 → 顶级消费者(入度为0,终点)。代码采用反向统计的思路,从终点(入度为 0 的顶级消费者)出发,反向遍历到起点(出度为 0 ...
2026-03-12
0
21
题解 | Tokitsukaze and Colorful Chessboard
#include<bits/stdc++.h> using namespace std; using ll=long long; const ll N=1e5; ll pre[N]; int main(){ ios::sync_with_stdio(0),cin.tie(0),...
2026-03-11
0
29
首页
上一页
1
2
3
4
5
6
7
8
下一页
末页