大事祭:
第一道绿题祭 P1439 最长公共子序列
AC100祭 P1443 马的遍历
去学分块 去学扩欧 去学数学 去学Trajan 去学二分图 去学图论
目标:
高一加油打出提高组省一!
一些板子:
fast read()
inline int read(){
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
return x*f;
}邻接表建图:
priority_queue<node>q;
struct edge_ {
int to,next,w;
} edge[maxn];
int cnt;
inline void add_edge(int u,int v,int w) {
edge[++cnt].to=v;
edge[cnt].w=w;
edge[cnt].next=head[u];
head[u]=cnt;
}重载运载符
struct node{
int res,id;
};
bool operator < (node a,node b) {
return a.res>b.res;
};cin /cout 优化
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);离散化
for(int i=1;i<=n;i++){cin>>a[i];b[i]=a[i];}
sort(b+1,b+n+1);
int len=unique(b+1,b+n+1)-b-1;
for(int i=1;i<=n;i++) a[i]=lower_bound(b+1,b+len+1,a[i])-b;