自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

俯首鸟瞰星火燎原

sec cos tarjan

  • 博客(30)
  • 收藏
  • 关注

原创 CF1551B Wonderful Coloring

文章目录CF1551B1 Wonderful Coloring - 1CF1551B2 Wonderful Coloring - 2CF1551B1 Wonderful Coloring - 1题目描述AC代码:#include<bits/stdc++.h>using namespace std;long long num,ans,n;int a[30];string p;int main(){ int t; cin>>t; while(t--){ mem

2021-11-18 10:26:09 138

原创 CF1545A

题目描述TLE代码:(O(N^2))#include<bits/stdc++.h>using namespace std;int n,b[100005],pl;bool v[100005];struct node{ int num; int x;}a[100005];bool cmp(node a,node b){ return a.x<=b.x;}int main(){ int t; cin>>t; while(t--){ pl=1;

2021-11-16 18:45:37 664

原创 CF749C

题目描述AC代码:#include<bits/stdc++.h>using namespace std;int x,ta=0,tb=0;char p;bool n[2000005];queue<int> aa;queue<int> bb;queue<int> t;int main(){ memset(n,0,sizeof(n)); cin>>x; p=getchar(); for(int i=1;i<=x;i++)

2021-11-15 19:50:41 489

原创 CF448C

题目描述AC代码:#include<bits/stdc++.h>using namespace std;int n,a[5010];int dfs(int l,int r){ if(l>r) return 0; if(l==r) return min(a[l],1); int maxn=0,x=2e9; for(int i=l;i<=r;i++){ if(x>a[i]){ x=a[i]; maxn=i; } } for(int i=l

2021-11-15 18:39:11 121

原创 CF1400E

题目描述AC代码:#include<bits/stdc++.h>using namespace std;int n,a[5010];int dfs(int l,int r){ if(l>r) return 0; if(l==r) return min(a[l],1); int maxn=0,x=2e9; for(int i=l;i<=r;i++){ if(x>a[i]){ x=a[i]; maxn=i; } } for(int i=l

2021-11-15 18:34:24 82

原创 快读模板2.0

#include<bits/stdc++.h>using namespace std;int inline read(){ int x=0,f=1; char c=getchar(); while(c<'0'||c>'9'){ if(c=='-')f=-1; c=getchar(); } while(c>='0'&&c<='9'){ x=x*10+c-'0'; c=getchar(); } return x*f;}in

2021-10-20 20:00:18 65

原创 微积分三类换元(待完成)

2021-10-16 21:39:24 433

原创 合并石子(算法进阶)(待完成)

#include<bits/stdc++.h>using namespace std;int f[4005][4005];int sum[40005],a[40005];int n;inline int read(){ int x=0,f=1; char ch=getchar(); if(!isdigit(ch)){ if(ch==45)f=-1;ch=getchar(); } while(isdigit(ch)){ x=x*10+ch-48;ch=getchar()

2021-10-16 21:22:22 95 1

原创 快读模板

inline int read(){int x=0,f=1;char ch=getchar();if(!isdigit(ch)){if(ch==45)f=-1;ch=getchar();}while(isdigit(ch)){x=x10+ch-48;ch=getchar();}return xf;}

2021-10-16 20:35:06 105 1

原创 高精度模板2.0

代码:#include<bits/stdc++.h>using namespace std;const int SIZE=10010;struct Int{ int len,n[SIZE]; void Set(int l){ len=l; for(int i=1;i<=len;i++) n[i]=0; } Int(char *s){ len=strlen(s); for(int i=len-1;~i;i--){ if(s[i]<='9'&

2021-10-16 19:20:01 94 1

原创 命名空间小技巧

#include<bits/stdc++.h>namespace baoli{ void work(){ return; }}namespace std{ void work(){ return; }}int main(){ baoli::work(); std::work(); return 0;}作用:节省空间小数据不爆零。

2021-10-09 22:09:51 643 1

原创 输入黑科技

#include<bits/stdc++.h>using namespace std;int main(){ int a[10010]; int n=0,x; while(~scanf("%1d",&x)){ a[++n]=x; } for(int i=1;i<=n;i++) printf("%d ",a[i]); return 0;}

2021-10-09 22:03:03 55 1

原创 合并石子(洛谷)

合并石子#include<iostream> #include<cstdio> #include<cmath> using namespace std; int n,minl,maxl,f1[300][300],f2[300][300],num[300]; int s[300]; inline int d(int i,int j){return s[j]-s[i-1];} //转移方程:f[i][j] = max(f[i][k]+f[k+1

2021-10-09 21:58:55 103 1

原创 高精度(模板)

代码 :#include<bits/stdc++.h>using namespace std;const int MAX_SIZE = 1010;struct Int { int len, n[MAX_SIZE]; void Set(int l) { len = l; for(int i = 1; i <= len; i ++) n[i] = 0; } Int(char *s) { len = strlen(s); for(int i = len - 1;

2021-10-08 23:04:42 56 1

原创 SP15637 GNYR04H - Mr Youngs Picture Permutations(洛谷)

https://www.luogu.com.cn/problem/SP15637算法:(线性DP);代码:#include<bits/stdc++.h>using namespace std;int t,n[10];int main(){ while(cin>>t){ if(t==0){ return 0; } memset(n,0,sizeof(n)); for(int i=

2021-10-06 21:52:01 191 1

原创 关押罪犯(洛谷)

P1525【NOIP2010 提高组】 关押罪犯算法:图论,贪心,并查集,排序,二分图代码:#include <cstdio>#include <algorithm>using namespace std;struct data{ int x; int y; int z;}f[100005];int n,m,fa[20005],b[20005],i;bool cmp(data a,data b){ return a.z>b.z;}int

2021-10-06 10:24:41 133 4

原创 洛谷有人疯了!!!

洛谷名人几年前经典案例总结:作了不一定会死,但死了一定是作的!!!

2021-10-05 21:56:22 1163 7

原创 最近公共祖先(LCA)(洛谷)

P3379代码:#include<bits/stdc++.h>using namespace std;const int SIZE=500005;int head[SIZE],nxt[SIZE*2],ver[SIZE*2],tot=0;int n,m,s,t,d[SIZE],f[SIZE][20];queue<int> q;void add(int x,int y){ ver[++tot]=y,nxt[tot]=head[x],head[x]=tot;}voi

2021-10-05 21:40:08 86 2

原创 最小生成树(洛谷)

P3366代码(Kruskal算法):#include<bits/stdc++.h>using namespace std;struct rec{ int x; int y; int z;}edge[200005];int n,m,ans,tot=0;int fa[5005];bool cmp(rec a,rec b){ return a.z<b.z;}int get(int x){ if(fa[x]==x) return x; else return f

2021-10-05 21:08:24 119 2

原创 单元最短路径(洛谷)

P3371P4779代码(Dijkstra算法):#include<bits/stdc++.h>using namespace std;const int N=10005;const int M=500005;int head[M],edge[M],ver[M],nxt[M],tot=0;bool v[N];int d[N];long long n,m,s;priority_queue< pair<int,int> > q;void add(in

2021-10-05 20:48:26 92 3

原创 2021-10-05模拟赛总结

文章目录总括一、寻找道路二、国王游戏三、书柜的尺寸四、海底珍珠串总括题数:4时间:4h得分:一、寻找道路P2296 寻找道路来源:洛谷(NOIP2014 提高组)算法:图论,搜索,模拟水题得分:100代码:#include<bits/stdc++.h>using namespace std;int n,m,ss,ee;bool p1[10005],p2[10005];int head1[200005],nxt1[200005],ver1[200005],

2021-10-05 14:23:06 599 5

原创 字典树(洛谷)

P2580 于是他错误的点名开始了map代码:#include<bits/stdc++.h>using namespace std;typedef long long ll;map<string,int>a; string s;int n,m;int main(){ cin>>n; while(n--){ cin>>s; a[s]=1; } cin>>m; while(m-

2021-10-05 06:54:52 191 6

原创 发射站(洛谷)

P1901发射站算法:单调栈代码:#include<bits/stdc++.h>using namespace std;const int N=1000010;int h[N],v[N],ans[N],mx;stack<int> s;int main(){ int n; cin>>n; for(int i=1;i<=n;i++) cin>>h[i]>>v[i]; for(int i=1;i&lt

2021-10-04 19:47:36 253 1

原创 单调栈(洛谷)

P5788(洛谷)P5788 单调栈思路:维护一个单调递减的栈,重复执行:当入栈的下标所对应的值,那么入栈的下标为栈顶下标的f(x)的值,存入ans函数,并弹出栈顶元素。代码:#include<bits/stdc++.h>using namespace std;stack<int> w;int a[3000005],ans[3000005];int n;int main(){ scanf("%d",&n); for(int i=1;i<=n;i

2021-10-04 19:23:09 374 5

原创 树状数组模板(洛谷)

P3374#include<bits/stdc++.h>using namespace std;#define maxn 500010int a[maxn],f[maxn],n,m;int lowbit(int x){ return x&-x;}void addion(int x,int y){ while(x<=n){ f[x]+=y; x+=lowbit(x); }}int getsum(int x){ int ans=0; while(x)

2021-10-04 17:29:57 46 1

原创 tarjan割点《算法进阶》

代码:#include<bits/stdc++.h>using namespace std;const int SIZE=100010;int head[SIZE],ver[SIZE*2],Next[SIZE*2];int dfn[SIZE],low[SIZE],stack[SIZE];int n,m,tot,num,root;bool cut[SIZE];void add(int x,int y){ ver[++tot]=y,Next[tot]=head[x],head[x

2021-10-04 16:35:27 80 5

原创 蚯蚓的正解

文章目录前言一、正解(摘自洛谷aiyougege)二、原理(摘自洛谷大佬)总结前言真的很意外,这题代码标的是二叉堆,但是优先队列和手打堆都TLE,(大概80~90的样子),去看了一下评论区,发现正解是三队列,(这就很离谱)。一、正解(摘自洛谷aiyougege)#include<algorithm>#include<iostream>#include<cstdio>#include<queue>#include<cmath>#d

2021-10-04 16:03:58 114 3

原创 没什么东西

来一幅“我的梦想"不喜勿喷!!!谢谢!!!

2021-10-04 15:43:14 1115 10

原创 2021-10-04模拟赛总结

文章目录总括一、pandas是什么?二、使用步骤1.引入库2.读入数据总结总括一、pandas是什么?示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。二、使用步骤1.引入库代码如下(示例):import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport warningswarnings.filterwarning.

2021-10-04 14:58:12 141 4

原创 2021-10-03 模拟赛总结

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档文章目录基本信息一、Cheese二、使用步骤1.引入库总结基本信息题数:4时间:3.5h分数:153/400来源:2017noip一、Cheese算法:BFS宽搜/并查集代码:#include<bits/stdc++.h>using namespace std;struct node{ long long x; long long y; long long z;}a[2005];long l

2021-10-03 15:55:23 130 5

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除