摘要:
a是主串,b是要找的串 const int N=1e5+10; char a[N]; char b[N]; int Next[N]; void find_Next() { Next[0]=0; int len=strlen(b),k=0; rep(i,1,len) { while(k&&b[k]!= 阅读全文
摘要:
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output You are given a string s consisting only of c 阅读全文
摘要:
Merge sort is a well known sorting algorithm. The main function that sorts the elements of array a with indices from [l, r) can be implemented as foll 阅读全文
摘要:
Yet another round on DecoForces is coming! Grandpa Maks wanted to participate in it but someone has stolen his precious sofa! And how can one perform 阅读全文
摘要:
某国的足球联赛中有N支参赛球队,编号从1至N。联赛采用主客场双循环赛制,参赛球队两两之间在双方主场各赛一场。 联赛战罢,结果已经尘埃落定。此时,联赛主席突发奇想,希望从中找出一条包含所有球队的“食物链”,来说明联赛的精彩程度。“食物链”为一个1至N的排列{ T1,T2⋯ TN },满足:球队T 阅读全文
摘要:
就是二分查找就够了,找到符合条件的那个最小值 不会二分可以去学一下,可以看看这个:https://www.cnblogs.com/wzl19981116/p/9354012.html include include include include include include include in 阅读全文
摘要:
就是括号匹配的题目,如果有交集就是NO include include include include include using namespace std; stack s; int a[200005]; int main() { int t,n,m,temp1,temp2,i; scanf(" 阅读全文
摘要:
最小生成树直接用kruskal就好了 include define sf scanf define scf(x) scanf("%d",&x) define scff(x,y) scanf("%d%d",&x,&y) define scfff(x,y,z) scanf("%d%d%d",&x,&y, 阅读全文
摘要:
就是dijkstra,只是他有很多个起点,那么我们只要用一个超级源点,让他到每一个七点的距离为0 include include include include include include include include include include define sf scanf defin 阅读全文
摘要:
就是找总共有多少个球星,可以用并查集或者targin就强连通分量有多少个 targin的 阅读全文