ac aeronet

Read about ac aeronet, The latest news, videos, and discussion topics about ac aeronet from alibabacloud.com

ZOJ 3228Searching the String ac automaton does not repeat the match

This method of judging really didn't think ...For the match m in S, if the previous match position of M is the match position of the pre with this time now satisfies Now-pre >= m.length, then add 1.The judgment was too 233 .#include ZOJ 3228Searching the String ac automaton does not repeat the match

HDU 2896 virus Attack (AC automaton)

viruses. At this time he did not know where to start. So I would like to ask you to help. Small T is also a short-tempered oh, so the faster the better to solve the problem Oh ~ ~Input first line, an integer N (1Next n rows, each line represents a virus signature, and the signature string length is between 20-200.Each virus has a number, according to 1-n.Virus signatures of different numbers will not be the same.After this line, there is an integer M (1Next m line, each line represents a websit

HDU 3065 virus attack persists (AC automaton)

characters (not including carriage returns).Output is one per line in the following format, outputting the number of occurrences per virus. No output is required for viruses that do not appear.Virus signature: Number of occurrencesA colon is followed by a space that is output in the order in which the virus signature is entered.Sample Input3aabbccooxxcc%daaaoen .... ENDSample OutputAa:2cc:1Hinthit: All cases not mentioned in the title description should be considered. For example, two virus sig

A KUANGBIN~~AC automatic version of the sub, with annotations, the role of counting.

The dictionary tree of the cock silk ... Drunk ...#include#include#include#include#include#include#includeUsingNamespace Std;struct Trie{int Next[500010][26],fail[500010],isend[500010];int root, L;IntNewNode(){For(int I=0; I26; I++)This string of jumps empties next[L][i]=-1; Isend[L++]=0;Not a node layerReturn L-1;Returns the ordinal of this point}voidInit(){L=0; Root=NewNode();Give the root a point}voidInsert(Char buf[]){int Len=Strlen(buf);int now= root;For(int I=0; I; I++){If(Next[Now][buf[I]

AC Automatic Machine

(intI=1; i)Wuyi { thevis[pos]=true; - intt=str[i]-'a'+1; Wu while(!son[pos][t]) pos=Fail[pos]; -pos=Son[pos][t]; About if(!Vis[pos]) $ for(intj=pos;j;j=Fail[j]) - { -ans+=Word[j]; -word[j]=0; A } + } the returnAns; - } $ intMain () the { thescanf"%d",Kase); the for(intKase=1; kase) the { -scanf"%d",N); Init (); in for(intI=1; i) the { thescanf"%s", str+1); About Insert (str); the } the Mak

HDU 5412--CRB and Queries —————— "segment tree set Treap (no AC)"

Contest 10The main topic: give you a series of n number, q times asked. Ask 1 to change a location to value B. Ask 2 then ask L-r what is the number of K-large between. Simply put, it is the dynamic interval K problem with the modification.Problem-solving idea: Maintain CI's position in the number of numbers in the series after the treap, and maintain CI's positional relationship in the sequence by using the line tree. In fact, I think this is the connotation. Then for the query interval l-r th

"BZOJ-3172" Word AC automatic machine

[i]-'a']=++sz; X=son[x][s[i]-'a']; sum[x]++; } POS=x;}voidBuildfail () {intHead=0, tail=1; q[0]=1; fail[1]=0; while(headtail) { intnow=q[head++]; for(intI=0; i -; i++) { if(!son[now][i])Continue; intff=Fail[now]; while(!son[ff][i]) ff=FAIL[FF]; Fail[son[now][i]]=Son[ff][i]; Q[tail++]=Son[now][i]; } } for(inti=tail-1; i>=0; i--) Sum[fail[q[i] ]+=Sum[q[i]];}intMain () {clear (); scanf ("%d",N); for(intI=1; i) scanf ("%s", s), insert (Loc

pat:1003. Emergency (+) AC

#include#include#includeUsingnamespace Std;Constint maxv=510;Constint inf=0X3FFFFFFF;int n,m,c1,c2;BOOL VIS[MAXV];int G[MAXV][MAXV];Distance between citiesint WEIGHT[MAXV];Number of rescuers in each cityint D[MAXV];Shortest distanceint W[MAXV];Can bring the most peopleint NUM[MAXV];Shortest Path Bar numbervoid Dijkstra (int s) {memset (num,0,sizeof (num)); memset (Vis,Falsesizeof (VIS)); Fill (D,d+maxv,inf); Memset (W,0,sizeof (w)); d[s]=0;The city distance to the city is 0 W[s]=weight[s];The nu

pat:1069. The Black Hole of Numbers (a) AC

#include#includeUsingnamespace Std;Constint aim=6174;int n;int arr[4];BOOL Nonincreasingorder (int A,int b) {return a>b;}BOOL Nondecreasingorder (int A,int b) {return aint Tonum ()Get this number {int sum=0;Forint i=0; i4; ++i) {sum=sum*10+arr[i]; }return sum;}void Toarr () {Forint i=0; i4; ++i)Disassemble number {arr[i]=n%10; N/=10; }}int main () {scanf ("%d", n);int Min,max;//the minimum number of permutations, the maximum number of permutations while (1) {Toarr (); //disassembly sort (arr,arr

pat:1048. Find Coins (25) (two-point lookup) AC

#include#includeUsingnamespace Std;int arr[100066];int FIND (int L,int R,int aim)Binary lookup, from L to R, find aim{int mid;while (l2;if (Arr[mid]==aim)return mid;Find: Return coordinatesElseif (Arr[mid]1;else r=mid-1; }Return-1;Not found}int main () {int n,m; scanf"%d%d", n,m);Forint i=0; I"%d", arr[i]); Sort (arr,arr+n);Sorting before you can find it with two pointsfor (int i=0; iint x=find (i+1,n-1,m-arr[i]); //find the opposite number labeled I number, L from the beginning of the i+1 can b

pat:1048. Find Coins (25) (hash table method) AC

#include#includeint harsh[1066];int main () {memset (HARSH,0,sizeof (HARSH));int n,m; scanf"%d%d", n,m);Forint i=0; Iint tmp; scanf"%d", tmp); ++HARSH[TMP]; }Forint i=0; i1066; ++i) {if (harsh[i]==0" //this number does not continue; if (harsh[m-i]>0) {if (i==m-i HARSH [I]2) //these two numbers are the same time, but only one is available, also not continue ; printf ( "%d%d" I,m-i ); //has ruled out the possibility of output, the conditions are satisfied on the output return 0;} printf ( Span cl

pat:1029. Median (+) AC

#include#includeUsingnamespace Std;int arr1[1000066];int arr2[1000066];int main () {int n1,n2; scanf"%d", AMP;N1);Forint i=0; I"%d", arr1[i]);} scanf"%d", AMP;N2);Forint i=0; I"%d", arr2[i]);} arr1[n1]=0x7fffffff,arr2[n2]=0x7FFFFFFF"Caution" because when the output is the minimum number, it is possible to set the end of the last number of arrays is infiniteint middle= (n1+n2-1)/2;int i1=0,i2=0; //represents two arrays currently pointing, starting from 0 for (int I=0; I//find the first middle sma

pat:1086. Tree traversals Again (+) AC

#include#include#includeUsingnamespace Std;Constint max=50;int n,cnt=0;n nodes, CNT controls the number of spaces in the post-order outputint Pre[max],in[max];First Order, middle orderint Prei,ini;The subscript stackInt> S;Stackstruct node{int data; node* l; node* R;}; node* Create (int PreL,int Prer,int InL,int InR) {if (prel>prer)ReturnNULL; node* root=New node; root->data=pre[prel]; Root->l=NULL; Root->r=NULL;int k;for (K=INL; kFind this node in the middle orderif (In[k]==root->data)Breakint

pat:1053. Path of Equal Weight (AC)

#include#include#include#includeUsingnamespace Std;Constint max=1010;int n,m;n nodes, m non-leaf nodesLongLongint S;Right value to be measuredLongLongint Weight[max];The weight of each node vectorInt> Child[max];Storage nodeBOOL CMP (int A,int b) {return weight[a]>weight[b];}LongLongint sum=0;vectorInt> path;Save Path Weight valuevoid DFS (int root) {if (child[root].size () = =0) {if (sum==s) {printf ("%d", Path.front ());The weight s is not 0, and the condition must have a path. Single output f

pat:1090. Highest price in supply Chain (+) AC

#include#includeUsingnamespace Std;Constint max=100010;int depest=0,times=0;vectorInt> Child[max];child[father [Child] two-dimensional array representation tree structurevoid DFS (int root,int depth) {if (child[root].size () = =0)The leaf node begins to judge the depth {if (depth>depest) {depest=depth; times=1; }Elseif (depth==depest)The same as the deepest depth, the number of times plus 1 ++times;Return }Forint i=0; I1);}int main () {int root=-1,n;Double p,r; scanf"%d%lf%lf", n,p,r); R/=100;in

AC Diary-Milking Valley P1204

; Tree[now1].flag_ (); Tree[now1].dis=false; Tree[now1|1].flag_ (); Tree[now1|1].dis=false;}voidTree_change (intNowintLintR) { if(tree[now].l==ltree[now].r==r) {Tree[now].dis=false; Tree[now].flag_ (); return ; } if(Tree[now].flag) Tree_down (now); if(R1, L,r); Else if(L>tree[now].mid) Tree_change (now1|1, L,r); Else{Tree_change ( now1, L,tree[now].mid); Tree_change ( now1|1, tree[now].mid+1, R); }}voidTree_result (intNow ) { if(Tree[now].if_ ()) {result[++cnt]=Tree[now].dis; re

AC Diary--sliding window Valley P1886

[now].r=R; if(l==r) {tree[now].dis_ (); return ; } tree[now].mid_ (); Tree_build ( now1, L,tree[now].mid); Tree_build ( now1|1, tree[now].mid+1, R); TREE_UP (now);} InlineclassT_ans Ans_ (intMiintMa) { classT_ans Cur_; CUR_.MAXN=Ma; Cur_.minn=mi; returnCur_;}classT_ans Tree_query (intNowintLintR) { if(tree[now].l==ltree[now].r==r) {returnAns_ (Tree[now].dis_min,tree[now].dis_max); } if(L>tree[now].mid)returnTree_query (now1|1, L,r); Else if(RreturnTree_query (now1, L,r); Else {

AC Diary-looking for the road Valley P2296

;structNode {int from, To,dis,next;};structNode edge[200001],edge_[200001];intn,m,head_[10001],head[10001],s,t,num=0, dis[10001];BOOLif_[10001],can[10001];inlinevoidEdge_add (int from,intTo,intDis_) {num++; Edge[num].to=to ; Edge[num].dis=Dis_; Edge[num]. from= from; Edge[num].next=head[ from]; head[ from]=num; Edge_[num]. from=to ; Edge_[num].to= from; Edge_[num].dis=Dis_; Edge_[num].next=Head_[to]; Head_[to]=num;}voidSearchintNow ) {If_[now]=true; for(intI=head_[now];i;i=Edge_[i].next) {

[An Ac a day ^_^] POJ 3254 Corn Columnar pressure DP

be grazing in I state - { $ if(!judge (i)) the { thest[k++]=i; the } the } - for(intI=0; i//Initialize the first line of State in { thedp[0][i]= (!judge (0, i)); the } About for(intI=1; i) the { the for(intj=0; j) the { + if(Judge (I,j))Continue;//Determine if line I can herd cows in J. - for(intL=0; l) the {Bayi

"Noip Simulation" "Messing with AC" "greedy" "simulation" match

only the R pointer is moved back. If the current blue block length is larger than the current yellow brick length plus y, then move the L pointer.AC Code:1#include 2 intN,m,x,y,l=1, r=1;3 intylw[100010],ble[100010];4 Long Longans;5 intMain () {6scanf"%d%d%d%d",n,m,x,Y);7 for(intI=1; i"%d",ylw[i]);8 for(intI=1; i"%d",ble[i]);9 while(lN) {Ten if(ble[r]>ylw[n]+y| | ble[m]1]-x) Break;//Special Award of extreme situations One if(ble[r]>=ylw[l]-xble[r]Continue;} A

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

not found

404! Not Found!

Sorry, you’ve landed on an unexplored planet!

Return Home
phone Contact Us
not found

404! Not Found!

Sorry, you’ve landed on an unexplored planet!

Return Home
phone Contact Us

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.