UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214004#2739. 阿空的核聚变stawalr0789ms1872kbC++111.1kb2024-11-14 22:18:262024-11-14 23:10:08

answer

#include<bits/stdc++.h>
using namespace std;
const int ml=5e5+5,mn=1e6+5;
string s;
int f[ml][28],n,l;
int g[ml][20];
bool check(int x,int y)
{
    for(int i=19;i>=0;i--)
    {
        if(g[x][i] && g[x][i]<=y)x=g[x][i];
        cerr<<x<<" ";
    }
    cerr<<'\n';
    return (x==y);
}
int main()
{
    cin>>s;
    l=s.size();
    s=' '+s;
    for(int i=1;i<=l;i++)
    {
        f[i][s[i]-'a']=i;
    }
    for(int j=1;j<27;j++)
    {
        for(int i=1;i<=l;i++)
        {
            if(f[i][j])continue;
            if(!f[i][j-1])continue;
            f[i][j]=f[f[i][j-1]+1][j-1];
        }
    }
    for(int i=1;i<=l;i++)
    {
        g[i][0]=f[i][26];
        // cerr<<f[i][26]<<'\n';
    }
    for(int j=1;j<20;j++)
    {
        for(int i=1;i<=l;i++)
        {
            if(g[i][j-1]==0)continue;
            g[i][j]=g[g[i][j-1]+1][j-1];
        }
    }
    scanf("%d",&n);
    int x,y;
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&x,&y);
        if(check(x,y))
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }
}

详细

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

Test #1:

score: 0
Wrong Answer
time: 177ms
memory: 1324kb

input:

wwwwyyyvttttutsrqquuusstttuvutrrsvvwxvvwvvvvwuuvwvvwwuuurrssswywvvwvurrstxwvvxxxxxxyzvvvssrrsttvuuwy...

output:

No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

wrong answer 34th lines differ - expected: 'No', found: 'Yes'

Test #2:

score: 0
Wrong Answer
time: 126ms
memory: 1328kb

input:

wvvvvwwttuvwwyyxxwvvwwzywvttuusstuuwyyywwxyywvuttuuuttwxwwyyyxxzzxxxwvuuyyyyzvvvvwvvvvwwwztssuuuwwwy...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

wrong answer 34th lines differ - expected: 'Yes', found: 'No'

Test #3:

score: 0
Wrong Answer
time: 118ms
memory: 1324kb

input:

zywwxyyzyyvuttwvvwxutssvuuvyyzzyxxyxxzzyyxxyxxxxzyxxwuuvwwxwwyxxyvvttuvxyyyxxyyyyyxxyyxwwxxyyyvuuwww...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

wrong answer 17th lines differ - expected: 'Yes', found: 'No'

Test #4:

score: 0
Wrong Answer
time: 143ms
memory: 1868kb

input:

zzzyywwxyzxxyzyyzzyyyyzyyzyxxzzzzyyyyyxxyyzzyxxzzyyzzzyyzyyzzzzyyyyzzzxwwwwxzzzzyyzxxyyyzzyyyyyyzzzy...

output:

No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

wrong answer 2nd lines differ - expected: 'No', found: 'Yes'

Test #5:

score: 0
Wrong Answer
time: 129ms
memory: 1872kb

input:

yxxyxxzzyyxxyyxxxxxxxwvuuxvvwyyxxxxyyyyxxwwxzyxxyxxyyyxwvuttywvvxxxywwxywwxxwuuuuzxxyxwwxvvwwuuvxyww...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

wrong answer 2nd lines differ - expected: 'Yes', found: 'No'

Test #6:

score: 0
Wrong Answer
time: 96ms
memory: 1872kb

input:

xxyywvvxyuuuuvvwwxxxttuvvvzvvwwwyyywwsstuuttvvwvttuwvurrrrsqqrxxvvttttvxuuvwvusstvvxwwyxxzzxwwxutsss...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

wrong answer 58th lines differ - expected: 'Yes', found: 'No'

Test #7:

score: 0
Time Limit Exceeded

input:

yyzzzyyzzzyyzzzzyzzyyzyyzzyzzyzzzzyyzyyzzyzyzyyzyzyzzzzzzyzzyzzzyyyzyyzzyyyzzyzyyzzzyyzyyzzzyzyzyzyy...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:


Test #8:

score: 0
Time Limit Exceeded

input:

yzzzzyzzyyzyzzzyyyzyyzyzzzyzyzzzzzzzyyyzyyzyzzzzyzzyyyyyzyyzyzyyzzzyzzyzzyzzzzzyyzyyyyyzyyyzzyzyzzyy...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:


Test #9:

score: 0
Time Limit Exceeded

input:

yyyyxxyzxxxxxxwvuuvvwzxxwwvuuvuuxutssvutssuttxxyxxxvvttuvxxywwxxwwyywwxyyywwxzyxwwxxywwwwyyyywwxyyvv...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:


Test #10:

score: 0
Time Limit Exceeded

input:

ywwxyyxxyzzzyxxyyyyzzzzzzyyzzyxxzzyyyxxzzzywwxzzyyzwwxxwwyyzyyzzzyyzyyyxwwyxxyyzyyyxxyyzyxxyyzzywwxw...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
...

result: