跳到正文

a_middle

939411

这个家伙很懒,什么也没有留下

在洛谷打开
资料、奖项与版本

资料

编号
939411
抓取

版本

  1. v2当前
  2. v1

https://www.cnblogs.com/nick-home/p/17478860.html

https://www.rngdle.com/

https://gofile.io/d/WJEQQH fs177

https://gofile.io/d/t4IPpR fs180

https://gofile.io/d/p1nLdI js

植物大战僵尸融合二创电脑版v3.4.1

恭喜洛谷评测量破两亿

https://note.ms/Amiddlefunarticle.md

https://v2.jinrishici.com/one.svg?font-size=200

平衡树——神贴

网络流新算法——O(m^1.33)

团队71107

*****

余潜,原名于焕堂,河南滑县人。新中国成立后曾任第二十一步兵学校政委、四川省军区政委等职。1961年晋升为少将军衔。

Graph

C++
 ______      ______  __  __      ______   _____   ______     
/\__  _\    /\  _  \/\ \/\ \    /\__  _\ /\  __ \/\__  _\    
\/_/\ \/    \ \ \ \ \ \ \/ /    \/_/\ \/ \ \ \/\ \/_/\ \/    
   \ \ \     \ \  __ \ \   <       \ \ \  \ \ \ \ \ \ \ \    
    \_\ \__   \ \ \/\ \ \ \\ \      \_\ \__\ \ \_\ \ \_\ \__ 
    /\_____\   \ \_\ \_\ \_\ \_\    /\_____\\ \_____\/\_____\
    \/_____/    \/_/\/_/\/_/\/_/    \/_____/ \/_____/\/_____/
   
// \\ \\ \\ \\ \\ \\ \\ \\ || || || || || || // // // // // // // //
// \\ \\ \\ \\ \\ \\ \\        _ooOoo_          // // // // // // //
// \\ \\ \\ \\ \\ \\          o8888888o            // // // // // //
// \\ \\ \\ \\ \\             88" . "88               // // // // //
// \\ \\ \\ \\                (| -_- |)                  // // // //
// \\ \\ \\                   O\  =  /O                     // // //
// \\ \\                   ____/`---'\____                     // //
// \\                    .'  \\|     |//  `.                      //
// ==                   /  \\|||  :  |||//  \                     ==
// ==                  /  _||||| -:- |||||-  \                    ==
// ==                  |   | \\\  -  /// |   |                    ==
// ==                  | \_|  ''\---/''  |   |                    ==
// ==                  \  .-\__  `-`  ___/-. /                    ==
// ==                ___`. .'  /--.--\  `. . ___                  ==
// ==              ."" '<  `.___\_<|>_/___.'  >'"".               ==
// ==            | | :  `- \`.;`\ _ /`;.`/ - ` : | |              \\
// //            \  \ `-.   \_ __\ /__ _/   .-` /  /              \\
// //      ========`-.____`-.___\_____/___.-`____.-'========      \\
// //                           `=---='                           \\
// // //   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  \\ \\
// // // //                                              \\ \\ \\ \\
// // // // // // // || || || || || || || || || || \\ \\ \\ \\ \\ \\

阿米诺斯就是氨基酸(amino acid)英文谐音简称

世界名画

卷心菜:虽然我很卷,但我还是菜

彩蛋

代码
《诗经·梅木》
梅木冬溪,思慕晚意
飞舞洒碧,碧漾东西
梅覆梅木,梅游佳亭
泉佳似广,梅忧寂极
糙泥马壁,坻石洞溪
时复思母,消愁东曦

模板

C++
struct epq{
	priority_queue<int,vector<int>,less<int> > q,p;//top大
	void push(int x){
		p.push(x);
	}
	void pop(){
		q.push(p.top());
	}
	void erase(int x){
		q.push(x);
	}
	int top(){
		while(!p.empty()&&!q.empty()&&q.top()==p.top()){
			q.pop();
			p.pop();
		}
		return p.top();
	}
	int size(){
		return p.size()-q.size();
	}
	bool empty(){
		return p.size()==q.size();
	}
}q1;
C++
struct node{
	int l,r,len;
	int sum,sl,sr;
	node friend operator +(node l,node r){
		node res;
		res.l=l.l;
		res.r=r.r;
		res.len=l.len+r.len;
		res.sum=l.sum+r.sum;
		if(l.r<=r.l){
			res.sum+=l.sr*r.sl;
			if(l.sl==l.len)res.sl=l.len+r.sl;
			else res.sl=l.sl;
			if(r.sr==r.len)res.sr=r.len+l.sr;
			else res.sr=r.sr;
		}
		else{
			res.sl=l.sl;
			res.sr=r.sr;
		}
		return res;
	}
};
struct TREE{
#define lson x<<1
#define rson x<<1|1
	node t[1600005];
	void build(int x,int l,int r){
		if(l==r){
			t[x].l=t[x].r=a[l];
			t[x].len=t[x].sum=t[x].sl=t[x].sr=1;
			return;
		}
		int mid=l+r>>1;
		build(lson,l,mid);
		build(rson,mid+1,r);
		t[x]=t[lson]+t[rson];
	}
	void update(int x,int l,int r,int d,int k){
		if(l==r){
			t[x].l=t[x].r=k;
			return;
		}
		int mid=l+r>>1;
		if(d<=mid)update(lson,l,mid,d,k);
		else update(rson,mid+1,r,d,k);
		t[x]=t[lson]+t[rson];
	}
	node quary(int x,int ls,int rs,int l,int r){
		if(l<=ls&&rs<=r)return t[x];
		int mid=ls+rs>>1;
		if(r<=mid)return quary(lson,ls,mid,l,r);
		if(mid<l)return quary(rson,mid+1,rs,l,r);
		return quary(lson,ls,mid,l,r)+quary(rson,mid+1,rs,l,r);
	}
#undef lson
#undef rson
}s;

线性筛模板

C++
#include<bits/stdc++.h>
using namespace std;
const int N=1000010;
bool f[N];//标记素数,0表示素数,1表是不是 
int primes[N],k=0,n;
int main(){
	cin>>n;
	f[0]=1;
	f[1]=1;
	for(int i=2;i<=n;i++){
		if(!f[i]){
			k++;
			primes[k]=i;
		}
		for(int j=1;i*primes[j]<=n;j++){
			f[i*primes[j]]=1;
			//如果 i%primes[j]==0i*primes[j+1]%primes[j]==0 
			if(i%primes[j]==0)break;
		}
	}
	cout<<k; 
	return 0;
}

哈希模板

C++
#include<bits/stdc++.h>
#define ULL unsigned long long
using namespace std;
ULL h[1000010],p[1000010];
char s[1000010];
ULL P=131;
inline ULL read(){
	ULL x=0,f=1;
	char ch=getchar();
	while(ch<48||ch>57){
		if(ch==45)f=-1;
		ch=getchar();
	}
	while(ch>=48&&ch<=57){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
void haxi(){
	ULL len=strlen(s+1);//要提前算好,不然会超时 
	p[0]=1;//这句必须要
	for(int i=1;i<=len;i++){
		p[i]=p[i-1]*P;
		h[i]=h[i-1]*P+(s[i]-'a'+1);
	} 
}
ULL geth(int x,int y){
	return h[y]-h[x-1]*p[y-x+1];//h[x-1]不要写成h[y-x+1],p[y-x+1]一定要加一 
}
int main(){
	scanf("%s",s+1);
	haxi();
	int m;
	cin>>m;
	int a1,b1,a2,b2;
	while(m--){
		a1=read();b1=read();a2=read();b2=read();
		if(geth(a1,b1)==geth(a2,b2)){
			cout<<"Yes\n";
		}
		else{
			cout<<"No\n";
		}
	}
	return 0;
}

链式前向星模板

C++
#include<bits/stdc++.h>
using namespace std;
//表示边
struct edge{
	//表示从from点到to点有边 
	//该边的上一条边是第next号边 
	int from,to,next;
}; 

edge a[10010];
int pre[1000100];
int n,e;
int k=0;

//建边
void add(int u,int v){
	k++;
	a[k].from=u;
	a[k].to=v;
	a[k].next=pre[u];
	pre[u]=k;
} 

//排序 
struct node{
	int x,y;
};

node p[10010];

bool cmp(node n1,node n2){
	return n1.x<n2.x || (n1.x==n2.x&&n1.y>n2.y);
}

int main()
{
	cin>>n>>e;
	int x,y;
	//读入e条边
	for(int i=1;i<=e;i++){
		cin>>p[i].x>>p[i].y;
	} 
	
	sort(p+1,p+e+1,cmp);
	
	for(int i=1;i<=e;i++){
		add(p[i].x,p[i].y);
	}
	
	for(int i=1;i<=n;i++){
		cout<<i<<"\n";
		for(int j=pre[i];j!=0;j=a[j].next){
			cout<<i<<"->"<<a[j].to<<"\n";
		}
	}
	return 0;
}

链式前向星+dijkstra(正数) 模板

C++
#include<bits/stdc++.h>
using namespace std;
int n,e;
struct edge{
	int from,to,next,len;
}; 
edge a[110000];
int k=0;
int pre[2005];
int s,t;
int d[2005];
bool f[2005];
void add(int u,int v,int l){
	k++;
	a[k].from=u;//可以不存 
	a[k].to=v;
	a[k].len=l;
	a[k].next=pre[u];
	pre[u]=k;
} 
const int INF=0x3f3f3f3f;
void dijkstra(){
	memset(d,0x3f3f3f3f,sizeof(d));
	d[s]=0;
	for(int i=1;i<=n;i++){
		int mi=-1;
		for(int j=1;j<=n;j++){
			if(!f[j]&&(mi==-1||d[j]<d[mi])){
				mi=j;
			}
		}
		f[mi]=true;
		for(int j=pre[mi];j!=0;j=a[j].next){
			int to=a[j].to;
			if(!f[to]&&d[mi]+a[j].len<d[to]){
				d[to]=d[mi]+a[j].len;
			}
		}
	}
}
int main()
{
	cin>>n>>e;
	int x,y,l;
	//读入e条边
	for(int i=1;i<=e;i++){
		cin>>x>>y>>l;
		add(x,y,l);
		add(y,x,l);
	} 
	cin>>s>>t;
	dijkstra();
	if(d[t]!=INF)  cout<<d[t];
	else cout<<"No path";
	return 0;
}
代码
共 9 篇
  1. 学习·文化课

    Payphone

    《Payphone》 填 词: _Adam Levine,Benny Blanco,Ammar Malik,Robopop_ 谱 曲: _Shellback,Benny Blanco_ 歌曲原唱: _Maroon 5,Wiz Khalifa_

    1 赞
  2. 休闲·娱乐

    贪吃蛇

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////…

  3. 休闲·娱乐

    规则怪谈

    #include<bits/stdc++.h> #include<windows.h> #include<conio.h> #include<mmsystem.h> #pragma comment(lib,"winmm.lib") using namespace std; str…