0_0_20614289_22564.cpp:14:5: error: 'qe' does not name a type
qe[maxn] ;void add(int c ,int l){ que[tot].init(); SAM *p = tail,*np=&que[tot++] ; np->len=l;tail=np ; while(p&&p->son[c]==NULL)p->son[c]=np,p=p->pre ; if(p==NULL) np->pre = root ; else { SAM *q = p->son[c] ; if(p->len+1==q->len)np->pre = q ; else { que[tot].init(); SAM *nq = &que[tot++] ; *nq=*q ; nq->len = p->len+1; np->pre=q->pre=nq; while(p&&p->son[c]==q) p->son[c]=nq,p=p->pre; } }}char str[maxn] ;int main(){ int i , j ,k ,len,n , m; int u,v ; node a ; while(scanf("%d%d",&n,&m) != EOF) { for(i=1;i<=n;i++) qe[i].clear(); len=1; for( i = 1 ; i <= n ;i++) { scanf("%s",str+len) ; k = strlen(str+len) ; s[i]=len; cnt[i]=k; len += k+1 ; } for( i = 1 ; i <= m ;i++) { scanf("%d%d",&u,&v) ; a.id = i ; a.u = v ; qe[u].push_back(a); } for( i = 1 ; i <= n ;i++) { if(qe[i].size()==0) continue ; sort(qe[i].begin(),qe[i].end()); tot=0; que[0].init(); root=tail=&que[tot++]; k=1; for( j = s[i] ; j < s[i]+cnt[i];j++){ add(id(str[j]),k++); } SAM *p= tail; while(p != NULL ) { p->vi = true; p=p->pre; } for( j = 0 ; j < qe[i].size();j++){ a=qe[i][j] ; ans[a.id]=0; if(j&&a.u==qe[i][j-1].u) { ans[a.id]=ans[qe[i][j-1].id]; continue ; } p = root ; int tmp=0; for( k = s[a.u] ; k < s[a.u]+cnt[a.u];k++) { int v = id(str[k]) ; if(p->son[v]==NULL) break ; p=p->son[v] ; tmp++; if(p->vi) ans[a.id]=max(ans[a.id],tmp); } } } for( i = 1 ; i <= m ;i++) printf("%d\n",ans[i]); } return 0 ;}
^
0_0_20614289_22564.cpp: In function 'void add(int, int)':
0_0_20614289_22564.cpp:14:42: error: 'que' was not declared in this scope
qe[maxn] ;void add(int c ,int l){ que[tot].init(); SAM *p = tail,*np=&que[tot++] ; np->len=l;tail=np ; while(p&&p->son[c]==NULL)p->son[c]=np,p=p->pre ; if(p==NULL) np->pre = root ; else { SAM *q = p->son[c] ; if(p->len+1==q->len)np->pre = q ; else { que[tot].init(); SAM *nq = &que[tot++] ; *nq=*q ; nq->len = p->len+1; np->pre=q->pre=nq; while(p&&p->son[c]==q) p->son[c]=nq,p=p->pre; } }}char str[maxn] ;int main(){ int i , j ,k ,len,n , m; int u,v ; node a ; while(scanf("%d%d",&n,&m) != EOF) { for(i=1;i<=n;i++) qe[i].clear(); len=1; for( i = 1 ; i <= n ;i++) { scanf("%s",str+len) ; k = strlen(str+len) ; s[i]=len; cnt[i]=k; len += k+1 ; } for( i = 1 ; i <= m ;i++) { scanf("%d%d",&u,&v) ; a.id = i ; a.u = v ; qe[u].push_back(a); } for( i = 1 ; i <= n ;i++) { if(qe[i].size()==0) continue ; sort(qe[i].begin(),qe[i].end()); tot=0; que[0].init(); root=tail=&que[tot++]; k=1; for( j = s[i] ; j < s[i]+cnt[i];j++){ add(id(str[j]),k++); } SAM *p= tail; while(p != NULL ) { p->vi = true; p=p->pre; } for( j = 0 ; j < qe[i].size();j++){ a=qe[i][j] ; ans[a.id]=0; if(j&&a.u==qe[i][j-1].u) { ans[a.id]=ans[qe[i][j-1].id]; continue ; } p = root ; int tmp=0; for( k = s[a.u] ; k < s[a.u]+cnt[a.u];k++) { int v = id(str[k]) ; if(p->son[v]==NULL) break ; p=p->son[v] ; tmp++; if(p->vi) ans[a.id]=max(ans[a.id],tmp); } } } for( i = 1 ; i <= m ;i++) printf("%d\n",ans[i]); } return 0 ;}
^
0_0_20614289_22564.cpp:14:46: error: 'tot' was not declared in this scope
qe[maxn] ;void add(int c ,int l){ que[tot].init(); SAM *p = tail,*np=&que[tot++] ; np->len=l;tail=np ; while(p&&p->son[c]==NULL)p->son[c]=np,p=p->pre ; if(p==NULL) np->pre = root ; else { SAM *q = p->son[c] ; if(p->len+1==q->len)np->pre = q ; else { que[tot].init(); SAM *nq = &que[tot++] ; *nq=*q ; nq->len = p->len+1; np->pre=q->pre=nq; while(p&&p->son[c]==q) p->son[c]=nq,p=p->pre; } }}char str[maxn] ;int main(){ int i , j ,k ,len,n , m; int u,v ; node a ; while(scanf("%d%d",&n,&m) != EOF) { for(i=1;i<=n;i++) qe[i].clear(); len=1; for( i = 1 ; i <= n ;i++) { scanf("%s",str+len) ; k = strlen(str+len) ; s[i]=len; cnt[i]=k; len += k+1 ; } for( i = 1 ; i <= m ;i++) { scanf("%d%d",&u,&v) ; a.id = i ; a.u = v ; qe[u].push_back(a); } for( i = 1 ; i <= n ;i++) { if(qe[i].size()==0) continue ; sort(qe[i].begin(),qe[i].end()); tot=0; que[0].init(); root=tail=&que[tot++]; k=1; for( j = s[i] ; j < s[i]+cnt[i];j++){ add(id(str[j]),k++); } SAM *p= tail; while(p != NULL ) { p->vi = true; p=p->pre; } for( j = 0 ; j < qe[i].size();j++){ a=qe[i][j] ; ans[a.id]=0; if(j&&a.u==qe[i][j-1].u) { ans[a.id]=ans[qe[i][j-1].id]; continue ; } p = root ; int tmp=0; for( k = s[a.u] ; k < s[a.u]+cnt[a.u];k++) { int v = id(str[k]) ; if(p->son[v]==NULL) break ; p=p->son[v] ; tmp++; if(p->vi) ans[a.id]=max(ans[a.id],tmp); } } } for( i = 1 ; i <= m ;i++) printf("%d\n",ans[i]); } return 0 ;}
^
0_0_20614289_22564.cpp:14:62: error: 'SAM' was not declared in this scope
qe[maxn] ;void add(int c ,int l){ que[tot].init(); SAM *p = tail,*np=&que[tot++] ; np->len=l;tail=np ; while(p&&p->son[c]==NULL)p->son[c]=np,p=p->pre ; if(p==NULL) np->pre = root ; else { SAM *q = p->son[c] ; if(p->len+1==q->len)np->pre = q ; else { que[tot].init(); SAM *nq = &que[tot++] ; *nq=*q ; nq->len = p->len+1; np->pre=q->pre=nq; while(p&&p->son[c]==q) p->son[c]=nq,p=p->pre; } }}char str[maxn] ;int main(){ int i , j ,k ,len,n , m; int u,v ; node a ; while(scanf("%d%d",&n,&m) != EOF) { for(i=1;i<=n;i++) qe[i].clear(); len=1; for( i = 1 ; i <= n ;i++) { scanf("%s",str+len) ; k = strlen(str+len) ; s[i]=len; cnt[i]=k; len += k+1 ; } for( i = 1 ; i <= m ;i++) { scanf("%d%d",&u,&v) ; a.id = i ; a.u = v ; qe[u].push_back(a); } for( i = 1 ; i <= n ;i++) { if(qe[i].size()==0) continue ; sort(qe[i].begin(),qe[i].end()); tot=0; que[0].init(); root=tail=&que[tot++]; k=1; for( j = s[i] ; j < s[i]+cnt[i];j++){ add(id(str[j]),k++); } SAM *p= tail; while(p != NULL ) { p->vi = true; p=p->pre; } for( j = 0 ; j < qe[i].size();j++){ a=qe[i][j] ; ans[a.id]=0; if(j&&a.u==qe[i][j-1].u) { ans[a.id]=ans[qe[i][j-1].id]; continue ; } p = root ; int tmp=0; for( k = s[a.u] ; k < s[a.u]+cnt[a.u];k++) { int v = id(str[k]) ; if(p->son[v]==NULL) break ; p=p->son[v] ; tmp++; if(p->vi) ans[a.id]=max(ans[a.id],tmp); } } } for( i = 1 ; i <= m ;i++) printf("%d\n",ans[i]); } return 0 ;}
^
0_0_20614289_22564.cpp:14:67: error: 'p' was not declared in this scope
qe[maxn] ;void add(int c ,int l){ que[tot].init(); SAM *p = tail,*np=&que[tot++] ; np->len=l;tail=np ; while(p&&p->son[c]==NULL)p->son[c]=np,p=p->pre ; if(p==NULL) np->pre = root ; else { SAM *q = p->son[c] ; if(p->len+1==q->len)np->pre = q ; else { que[tot].init(); SAM *nq = &que[tot++] ; *nq=*q ; nq->len = p->len+1; np->pre=q->pre=nq; while(p&&p->son[c]==q) p->son[c]=nq,p=p->pre; } }}char str[maxn] ;int main(){ int i , j ,k ,len,n , m; int u,v ; node a ; while(scanf("%d%d",&n,&m) != EOF) {
|