UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#210920#2067. 肉夹馍18112606231101465ms4276kbC++11760b2024-08-08 10:26:062024-08-08 14:28:46

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
char s[2000001];
int n,ans;
string ss;
bool flag;
unordered_map<string,bool> mp;
signed main()
{
    scanf("%s", s + 1);
    n = strlen(s + 1);
    for(int i=1;2*i<=n;i++)
    {
        ss+=s[i];
        mp[ss]=true;
        //cout<<ss<<endl;
    }
    ss="";
    
    printf("0 0 ");
    for(int i=3;i<=n;i++)
    {
        int m,ans;
        m=i/2+2;
        int res=0;
        ans=0;
        ss="";
        for(int j=i;j>=m;j--)
        {
            ss=s[j]+ss;
            res++;
            if(mp[ss])
            {
                ans=res;
            }
            //cout<<ss<<endl;
        }
        printf("%lld ",ans);
    }
    return 0;
}

Details

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 1408kb

input:

qpbvqpbvqpbvavdqpbvqpbvqpbvavdqpbvqpbvqpbvavdfnfninqpbvqpbvqpbvavdqpbvqpbvqpbvavdqpbvqpbvqpbvavd

output:

0 0 0 0 1 2 3 0 1 2 3 4 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15...

result:

ok 96 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 1420kb

input:

wfalgbgweavpwhfahfewhavweahuwbvbqvuivhuiaehufuaeuvdafuivjafislfhbibcuuiabcuibsv

output:

0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 79 tokens

Test #3:

score: 0
Accepted
time: 0ms
memory: 1264kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 ...

result:

ok 100 tokens

Subtask #2:

score: 0
Time Limit Exceeded

Test #4:

score: 20
Accepted
time: 713ms
memory: 3056kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 ...

result:

ok 3000 tokens

Test #5:

score: 0
Accepted
time: 752ms
memory: 4276kb

input:

cjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcjcj...

output:

0 0 1 0 1 2 3 2 3 4 5 4 5 6 7 6 7 8 9 8 9 10 11 10 11 12 13 12 13 14 15 14 15 16 17 16 17 18 19 18 1...

result:

ok 3000 tokens

Test #6:

score: -20
Time Limit Exceeded

input:

ckcckckcckcckckcckcckckcckcckckcsdvhckcckckcckcckckcckcckckcckcckckcsdvhckcckckcckcckckcckcckckcckcc...

output:

0 0 1 1 2 1 2 3 4 2 3 4 5 6 7 3 4 5 6 4 5 6 7 8 9 10 11 12 13 14 15 8 0 0 0 0 1 2 3 4 5 6 7 8 9 10 1...

result:


Subtask #3:

score: 0
Skipped

Subtask #4:

score: 0
Skipped