【模板】“万能挂件”


前言

整理文件翻出来2017年11月9日写的一个“万能挂件”,由于当时刚接触算法竞赛3个月,很多算法记不全,拿到一道题不知道该从哪下手,模板也背不熟,为了方便以后复制粘贴快速A题( ̄▽ ̄)~加强记忆,敲了这个代码出来。

代码

#include
#include
#include
#include
#include 
#include
#include
#include
#include
#include
int cur=1,cnt=0,a_sort[1000001];
const int mod=10000007;
const int N=100001;
const int maxN=100001;
const int INF=1<<30;
const int maxn=100001;
const int M=100001;
const int modd=10007;
const int max_yang=1001;
using namespace std;
struct The_quickprint{
	inline void quickwrite(int x){  
    	if(x==0){
       		putchar('0');
        	return;
   		}
    	int num=0;
    	char c[11]; 
    	while(x)c[++num]=x%10+48,x/=10; 
   		while(num)putchar(c[num--]);
	}
}the_quickprint;
struct The_quicksort{
	inline void quicksort(int left,int right){
		int t,temp,i,j;
		if(left>right)return;
		temp=a_sort[left];
		i=left,j=right;
		while(i!=j){
			while(a_sort[j]>=temp&&i0){
       	 	if (b&1) ans*=a;
       	 	a=a*a;
        	b>>=1; 
    	}
    	return ans;
	}
}the_fast_mi; 
struct The_read{
	inline int read_q(){
		char d=getchar();
		int c=0;
		while(d<'0'||d>'9')d=getchar();
		while(d>='0'&&d<='9')c=(c<<1)+(c<<3)+(d-48),d=getchar();
		return c;
	}
}the_read;
struct The_Hash{
    struct node{
    	string en,fn;  
    	int next;  
	}ed[maxn];  
	int head[mod];  
	inline int hash(string s){
    	int seed=131,key=0,len=s.length();  
    	for(int i=0;i>1;
			if(arr[mid]>1;
			if(arr[mid]>key)
				r=mid;
			else
				l=mid+1;
		}
		return l;
	}	
};
struct The_C_Tree{
	int c[M+1],p[M];
	inline int lowbit(int x){
		return x&(-x);
	}
	inline void change(int x,int d,int n){
		for(int i=x;i<=n;i+=lowbit(i))c[i]+=d;
	}
	inline int sum(int x){
		int s=0;
		for(int i=x;i>=1;i-=lowbit(i))s+=c[i];
		return s;
	}
}the_c_tree;
struct The_vector{
	vectorvec;
	inline void read_vec(int x){
		vec.push_back(x);
	}
	inline void the_sort(){
		sort(vec.begin(),vec.end());
	}
	inline int the_size(){
		return vec.size();
	}
}the_vector;
struct The_priority_queue{
	priority_queuep_q;
	inline void get_number(int x){
		p_q.push(x);
	}
	inline void use_number(){
		for(int i=0;i>1;
		cover(lson,l,mid,addv[o]);
		cover(rson,mid+1,r,addv[o]);
		addv[o]=0;
	}
	inline void build(int o,int l,int r){
		addv[o]=0;
		if(l==r){sumv[o]=a[l];return;}
		int mid=(l+r)>>1;
		build(lson,l,mid);build(rson,mid+1,r);
		pushup(o);
	}
	inline void optadd(int o,int l,int r,int ql,int qr,int v){
		if(ql<=l&&r<=qr){cover(o,l,r,v);return;}
		else{
			int mid=(l+r)>>1;
			if(addv[o]!=0)pushdown(o,l,r);
			if(ql<=mid)optadd(lson,l,mid,ql,qr,v);
			if(mid>1,ans=0;
		if(addv[o]!=0)pushdown(o,l,r);
		if(ql<=mid)ans+=querysum(lson,l,mid,ql,qr);
		if(midedge[maxn],v[maxn];
	inline int add(int x,int y,int z){
		edge[x].push_back(y);
		indegree[y]++;
		v[x].push_back(z);
	}
	inline int dfs(int x){
		cout<q;
		q.push(x);
		visited[x]=true;
		while(!q.empty()){
			int f=q.front();
			q.pop();
			cout<qu;
		memset(inq,0,sizeof(inq));
		for(int i=1;i<=n;i++)d[i]=INF;
		d[start]=0;inq[start]=1;qu.push(start);
		while(!qu.empty()){
			int u=qu.front();qu.pop();inq[u]=0;
			for(int i=0;ip_qu;
		for(int i=1;i<=n;i++)d[i]=INF;
		d[start]=0;
		p_qu.push((HeapNode){start,d[start]});
		while(!p_qu.empty()){
			HeapNode x=p_qu.top();p_qu.pop();
			int u=x.u;
			if(x.d!=d[u])continue;
			for(int i=0;itop_q;
		for(int i=0;iss;
	inline void ad(string c){
		ss.insert(c);
	}
	inline void del(string c){
		ss.erase(c);
	}
	inline bool fi(string c){
		return ss.count(c);
	}
	inline void for_set(){
		for(set::iterator it=ss.begin();it!=ss.end();++it){
			cout<<(*it)<mmp;
	inline void aad(string a,string b){
		mmp[a]=b;
	}
	inline bool fin(string a){
		return mmp.count(a);
	}
	inline void for_map(){
		for(map::iterator it=mmp.begin();it!=mmp.end();++it){
			cout<first<<" "<second<