sleeep3
sleeep3
全部文章
分类
题解(24)
归档
标签
去牛客网
登录
/
注册
sleeep3的博客
全部文章
(共24篇)
#题解##P3369 【模板】普通平衡树#
替罪羊树 #include<iostream> #include<algorithm> #include<vector> #include<stack> #include<string> #include<cstdio> #in...
C++
2026-01-30
0
11
#题解##P2024 [NOI2001] 食物链#
带权重的并查集(权重0代表与父节点同类,1为父节点食物即被父节点吃,2为吃父节点) #include<bits/stdc++.h> using namespace std; int arr[50010],da[50010];//并查集数组和权重数组 int fi(int x) { ...
C++
2026-01-23
0
16
#题解##P5908 猫猫和企鹅#
使用邻接表解决树上问题 #include<bits/stdc++.h> using namespace std; int n,d; int ans; bool vis[100010]={false}; vector<int> adj[100010];//创建 void dfs...
C++
2026-01-23
0
17
#题解##PEEK34 【模板】并查集#
#include<bits/stdc++.h> using namespace std; int arr[500010]={0}; int con[500010]={0}; int fi(int x) { if(arr[x]==x) { return x;...
C++
2026-01-23
0
12
#题解##UVA10608 Friends#
使用并查集算法 #include<bits/stdc++.h> using namespace std; int arr[30010]={0}; int fi(int x)//查找根节点 { if(arr[x]==x) { return x; } ...
C++
2026-01-23
0
14
#题解##P2880 [USACO07JAN] Balanced Lineup G#
st算法 #include<bits/stdc++.h> using namespace std; int n,q,l,r; int arr[50010]={0}; int dpmin[50010][21],dpmax[50010][22]; void stat() { for(...
C++
2025-12-19
0
19
#题解##P1816 忠诚#
静态区间查找最值使用st算法 #include<bits/stdc++.h> using namespace std; const int N=100010; int n,m; int a[N],dpmin[N][21]; void stint() { for(int i=1;i...
C++
2025-12-19
0
23
#题解##P3382 三分#
单峰函数,使用三分 #include<bits/stdc++.h> using namespace std; int n; double l,r,ee=1e-9; double arr[15]={0}; double f(double x); double power(double x,...
C++
2025-12-18
0
24
#题解##P1883 【模板】三分 / 函数 / [ICPC-Chengdu 2010] Error Curves#
根据题意可得F(x)为单谷函数,所以使用三分法求解。 #include<bits/stdc++.h> using namespace std; double t,n,a[10010]={0},b[10010]={0},c[10010]={0},ans; const double ee=1...
C++
2025-12-18
0
27
#题解##P1083 [NOIP 2012 提高组] 借教室#
利用了差分,前缀和和二分 #include<bits/stdc++.h> using namespace std; const int N=1e6; long long n,m,j[N+10],sh[N+10],st[N+10],ed[N+10],diff[N+10],pre[N+10]...
C++
2025-12-11
0
28
首页
上一页
1
2
3
下一页
末页