自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

细雨欣然

孤单是一个人的狂欢

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

原创 kd-tree

#include<bits/stdc++.h>#define alpha (1.130/2)#define INF 0x3f3f3f3fusing namespace std;typedef long long ll;const int DEM=2;const int maxn=1000010;int n,m,now,ans,root,points;queue<...

2019-11-14 23:33:11 207

原创 半平面交

#include <cstdio>#include <cmath>#include <iostream>using namespace std;#define eps 1e-8const int MAXN=10017;int n;double r;int cCnt,curCnt;//此时cCnt为最终切割得到的多边形的顶点数、暂存顶点个数str...

2019-11-01 23:52:20 165

原创 凸包 极角排序

const int maxn=1005;struct point{ int x; int y; point(){} point(int xx,int yy):x(xx),y(yy){} bool friend operator <(const point &a,const point &b){ if(a.x==b....

2019-10-31 22:49:36 311

原创 KM 二分图匹配

#include <bits/stdc++.h>const int maxn = 305;const int INF = 2e9;int match[maxn],lx[maxn],ly[maxn],slack[maxn];int G[maxn][maxn];bool visx[maxn],visy[maxn];int n,nx,ny,ans;bool findpath(...

2019-10-29 09:26:21 145

原创 等差数列除以一个数字求和(2019牛客暑期多校训练营(第九场)I题)

??神仙算法,类欧几里得的另一种用法首先对于一个a为公差,b为首项,n为项数的等差数列,我们以c为除数我们先考虑首项的贡献,很明显为b/c*n(还用你说 )。然后对于公差a,我们一共也是计算了(n-1)n次(1到n-1等差数列求和),所以也很明显是a/c(n-1)*n。到这里就完成一半了(根本还没开始 )因为是整除,所以接下来我们考虑加起来而导致的溢出情况(a<c,b<c,...

2019-08-16 13:41:27 375

原创 数学模板

#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=100005;const ll mod=100000007; //gcd ll gcd(ll x,ll y){return x==0?y:gcd(y%x,x);}//扩展欧几里得 ax+by=gcd(a,b)的解...

2019-08-09 15:26:54 280

原创 trie树

#include<cstdlib>#include<cstdio>#include<iostream>#include<cstring>using namespace std;const int maxn=50000*50+5;int m[maxn][52]={0},cnt=0,root=0,v[maxn]={0},n,mm;char...

2019-08-09 15:26:09 77

原创 2进制trie树

#include<cstdlib>#include<cstdio>#include<cstring>#include<iostream>#include<vector>using namespace std;const int maxn=250005;struct edge{ int u,v,w,next;}e...

2019-08-09 15:25:36 172

原创 求区间内最大(最小)子区间的线段树

#include<bits/stdc++.h>using namespace std;typedef long long ll;struct shu{ int l,r; ll w,lw,rw,ww;}w[100000];void up(int k,int l,int r){ int mid=(l+r)/2; int lk=k<&l...

2019-08-08 16:40:23 273

原创 匈牙利算法

#include<bits/stdc++.h> using namespace std;const int maxn=1010005;struct edge{ int v,next;}e[maxn*10];int f[10005],mx[maxn],state[maxn],fa[maxn]={0},n,cnt=0,T=0;void add(int u,int ...

2019-08-08 11:59:25 129

原创 支配树

#include<bits/stdc++.h> using namespace std;const int N = 200010;struct Node{int to,next;};//边 int n,m,dfn[N],clo,rev[N],f[N],semi[N],idom[N];// idom[x]是支配树上x的父亲 dfn[x]是x的拓扑序 //n个点m条边,n为...

2019-08-08 11:58:48 121

原创 主席树(可持久化线段树)

#include<iostream>#include<algorithm>#include<cmath>#include<cstdlib>#include<cstdio> using namespace std;const int maxn=1e6+10;//root数组代表第i颗树的根 //插入和查询都是 两棵树同步走相...

2019-08-08 11:57:45 102

原创 最短路径树

#include<iostream>#include<cstdio>#include<vector>#include<cstdlib>#include<queue>using namespace std;const int maxn=105;const int maxm=3005;const int inf=2000000...

2019-08-08 11:56:56 242

原创 最小表示法

#include<bits/stdc++.h> using namespace std; char a[105],b[105]; int n; set<string>q; int getmin() { int i=0,j=1,len=strlen(a),k=0; while(i<len&&j<len&&k&...

2019-08-08 11:56:25 173

原创 最小割树

#include<bits/stdc++.h> using namespace std;typedef long long ll;const int maxn=1005;const ll inf=20000000000005ll;struct edge //树上的边 { int u,v,next; ll w;}e[maxn*10];int f[maxn],cnt...

2019-08-08 11:55:55 108

原创 中国剩余定理

#include<iostream>#include<cstdlib>#include<cstdio>#include<algorithm>#include<cmath> using namespace std;typedef long long ll;ll n;ll a,b,x,y,d,A,B;void exgcd...

2019-08-08 11:54:01 119

原创 线段树

#include<bits/stdc++.h>using namespace std;int w[550005],n,m;void build(int k,int l,int r){ if(l==r) return; int mid=(l+r)>>1; build(k<<1,l,mid); build(k<<1|1,mid+1,r...

2019-08-07 11:36:26 84

原创 线性基

#include<bits/stdc++.h>using namespace std;typedef long long ll;struct LB{ long long b[65],nb[65]; int num; LB() { memset(b,0,sizeof(b)); memset(nb,0,sizeof(n...

2019-08-07 11:31:27 104

原创 倍增lca

#include<cstdlib>#include<iostream>#include<cstdio>#include<cstring>#include<vector>using namespace std;const int maxn=200005;int n,m,fa[maxn][25],deep[maxn];int...

2019-08-07 11:27:55 135

原创 并查集

#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1000005;int pa[maxn];int find(int x){return pa[x]==x?x:pa[x]=find(pa[x]);}void un(int x,int y){ int p...

2019-08-07 11:26:29 76

原创 带修莫队

#include<bits/stdc++.h>using namespace std; typedef long long ll;int n,m,l,r,sz,a[350005];int flag[1000005]={0},Ans[50005]={0},vis[50005]={0},last[50005],ans,now,tot=0,top=0;struct shu{...

2019-08-07 11:25:12 190

原创 费用流

#include<bits/stdc++.h>using namespace std;const int maxn=100005;const int inf=20000005;struct edge{ int u,v,f,c,w;};struct shu{ int id,sum; friend bool operator <(shu a,shu b) ...

2019-08-07 11:24:09 101

原创 高斯消元

#inlcude<bits/stdc++.h>using namespace std;const int maxn=105;double a[maxn][maxn];double x[maxn];void gauss(int n,int m){ int i=0,j=0,k,r,c; while(i<n&&j<m) {...

2019-08-07 11:19:44 96

原创 矩阵树定理

#include <bits/stdc++.h>using namespace std;#define maxn 90#define int long long #define mod 1000000000int n,m,f[maxn][maxn];int tot,Map[maxn][maxn];void add(int x,int y){ if(x>y...

2019-08-07 11:19:12 215

原创 马拉车

#include<bits/stdc++.h> using namespace std; char a[200005],ch[5],b[500005]; int d[500005]; int main() { while(~scanf("%s",a)) { int n=0,m; m=strlen(a); b[0]='&'; fo...

2019-08-07 11:18:36 103

原创 莫队

#include<bits/stdc++.h>using namespace std; typedef long long ll;int n,m,l,r,sz,a[100005];int flag[100005]={0},Ans[100005]={0},ans;struct shu{ int l,r,id; friend bool operator <(shu...

2019-08-07 11:18:03 187

原创 平衡树

#include<bits/stdc++.h>using namespace std;const int maxn=100005;int a[maxn],ch[maxn][2],fa[maxn],root,n,s[maxn];void up(int x){ s[x]=s[ch[x][0]]+s[ch[x][1]]+1;}void link(int x,int ...

2019-08-07 11:17:14 75

原创 spfa

#include<iostream>#include<cstdio>#include<vector>#include<cstdlib>#include<queue>using namespace std;const int maxn=105;const int maxm=3005;const int inf=2000000...

2019-08-07 11:16:14 99

原创 KMP

#include<bits/stdc++.h> using namespace std; int fail[10005],n,m,T; char a[1000005],b[10005]; void getnext() { fail[0]=-1; for(int i=0;i<m;i++) { int k=fail[i]; if(k!=-1&...

2019-08-07 11:15:35 112

原创 floyed

#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>using namespace std;const int maxn=405;const int inf=4000005;int d1[maxn][m...

2019-08-07 11:15:12 220

原创 CDQ分治

#include<bits/stdc++.h> using namespace std;typedef long long ll;const int maxn=1000005;struct shu{ int x,id,y; ll ans; friend bool operator <(shu a,shu b) { ret...

2019-08-07 11:14:33 99

原创 珂朵莉树

#include <bits/stdc++.h>using namespace std; typedef long long ll;const int mod7 = 1e9 + 7;const int maxn = 1e5 + 7; ll pow(ll a, ll b, ll mod){ ll res=1; for(a%=mod;b;a=a*a%mod,b...

2019-08-07 11:12:39 229

原创 对?什么不对!

我是一个讨厌麻烦的人却为了自己的财产安全费尽心思,我突然开始思考为什么。为什么好人活的担惊受怕,坏人却能逍遥法外。上次我女朋友被盗号,网络地址我弄到了,微信支付码我弄到了,其实只有查一下是谁,一切都解决了。但是因为跨省这件事就没人管了。这不怪警察,我认识太多的警察,有几个是因为热爱正义想去抓犯人当的警察,大多数都是因为迫不得已,或者为了维持生计而成为了警察。所以他们敬业,因为这毕竟是他们的职业,但...

2019-03-03 13:23:23 180

原创 数学与软件

01中的数学学了数学文化与思维的课程让我开始对数学有了新的认识,我开始不单单以工具的角度看待数学,也开始从思维的角度理解数学。而反思我自己的专业也是一样,软件在外行眼中也许就是一个使用的工具,他们不会去考虑为什么会有这个软件,这个软件是怎么想到的,是怎么实现的。对于我们软件的开发者软件不只是一个工具更是一种思维的创新与体现,作为开发者,相对于工具的使用更需要关注的是一个软件背后的想法与思考。数...

2018-12-14 18:15:56 856

原创 一个新的开始

从开学到现在我一直纠结在是否继续竞赛这条路,这条路的苦和累只有我们这些走过的才能真正明白。庆幸的是我没有失去最初的那份激动和热情,我所学的还是有着一定的意义,虽然在高三的一年里我忘记了绝大多数,现在的我最大的感受就是这个我学过,思想我记得,代码忘了。记得高一最开始抱着试试的心态去了数竞,在计算机课上知道了计算机竞赛,班上一群人说一起去试试,拉着我就去了。后来觉得数学无聊就放弃了数竞,那个时候竞赛...

2018-12-13 17:03:19 267 1

原创 “从我们能够预知未来的那一刻起,好事就会不断发生”

1.未来注定论当我第一次接触C++的随机函数的时候,我不禁对这个随机机理大为失望。这种通过在有限域内通过固定的公式迭代的方法,在初值确定的时候永远会得到相同的序列。这根本不能叫随机,只是我们没办法(?)预测它的结果,而且这个结果的分布很平均罢了。我开始在脑中思考一种真正的随机函数。可是我突然意识到一个问题——“什么是真随机?”迄今为止,人类对于世界的一切观测都表明,世界具有确定性。 举几个简单的

2017-04-06 10:09:19 1388

原创 uva1376 BZOJ1001 动物大逃亡

时间限制:5秒 内存限制:64M 【问题描述】   由于控制程序出错,动物园的笼子无缘无故被打开,所有动物展开了一次大逃亡。整个城市是一个网络,另外每个单位方格都有一条从左上到右下的对角线,其中动物园在左上角,动物们的目的地在右下角。所有道路(即网格的边和对角线)都是双向的。   每条道路上都有一个正整数权值,代表拦截着条边所需要的工作人员数,如图所示。你的任务是排尽量少的工作人员,使动物无法

2017-04-06 09:44:08 555

原创 poj 3469 Dual Core CPU

时间限制:1秒 内存限制:256M【问题描述】   要在由核A和B组成的双核CPU上运行N个任务。任务i在核A上执行花费为Ai,在B上执行花费为Bi。   其中有M个任务执行时需要交换数据,用一对整数ai,bi,表示任务ai和任务bi执行时需要交换数据,但如果他们在同一个核上执行则没有额外花费,否则会产生wi的花费。   问,所有任务都执行完后,最小的花费是多少。 【输入格式】   第一行为

2017-04-05 16:51:03 279

原创 bzoj1513 Tet-Tetris 3D(二维线段树)

时间限制:1秒 内存限制:64M【问题描述】   Tetris 3D “Tetris” 游戏的作者决定做一个新的游戏, 一个三维的版本。 在里面很多立方体落在平面板,一个立方体开始落下直到碰上一个以前落下的立方体或者落地即停止。作者想改变一下游戏的目的使得它更大众化,在新游戏中你将知道落下的立方体信息以及位置。   你的任务就是回答所有立方体落下后最高的方块的高度。所有的立方体在下落过程中都是

2017-04-05 16:21:42 304

原创 金矿师傅

时间限制:1秒 内存限制:64M【问题描述】   金矿的老师傅年底要退休了。经理为了奖赏他的尽职尽责的工作,决定在一块包含 n 个采金点的长方形土地中划出一块长度为 S(X轴方向),宽度为 W(y轴方向)的区域奖励给他,老师傅可以自己选择这块地的位置,显然其中包含的采金点越多越好。   你的任务就是计算最多能得到多少个采金点。如果一个采金点的位置在长方形的边上,它也应当被计算在内。【输入格式】

2017-04-02 17:02:28 652

空空如也

空空如也

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

TA关注的人

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