hiho Week 3 register

Ended

Participants:669

Verdict:Accepted
Submitted:2014-07-24 10:56:51

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<set>
#include<algorithm>
#include<vector>
char str1[10005];
char str2[1000005];
int next[10005];
void get_next(char str[],int n)
{
    int i=0,j=-1;
    next[0]=-1;
    while(i<=n)
    {
        if(j==-1||str[i]==str[j])
            next[++i]=++j;
        else
            j=next[j];
    }
}
int solve(int n,int m)
{
    int i=0,j=0;
    int ans=0;
    while(i<n&&j<m)
    {
        if(j==-1||str2[i]==str1[j])
        {
              i++;j++;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX