UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#213968#2739. 阿空的核聚变laiyishi6084ms1228kbC++11463b2024-11-14 20:18:022024-11-14 23:05:49

answer

#include<bits/stdc++.h>
using namespace std;
int n,q;char s[500005];
void solve(){
	int l,r,cur;scanf("%d%d",&l,&r);
	stack<int>stk;
	for(int i=l;i<=r;i++){
		cur=s[i]-'a';
		while(!stk.empty()){
			int x=stk.top();
			if(x!=cur)break;
			stk.pop(),cur++;
		}
		if(cur<26){
			stk.push(cur);
		}
	}
	if(stk.empty())printf("Yes\n");
	else printf("No\n");
}
int main(){
	scanf("%s",s+1);n=strlen(s+1);
	scanf("%d",&q);
	while(q--)solve();
} 

Details

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

Test #1:

score: 10
Accepted
time: 2ms
memory: 1224kb

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:

ok 3000 lines

Test #2:

score: 10
Accepted
time: 1ms
memory: 1228kb

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
Y...

result:

ok 3000 lines

Test #3:

score: 10
Accepted
time: 2ms
memory: 1228kb

input:

zywwxyyzyyvuttwvvwxutssvuuvyyzzyxxyxxzzyyxxyxxxxzyxxwuuvwwxwwyxxyvvttuvxyyyxxyyyyyxxyyxwwxxyyyvuuwww...

output:

No
No
No
No
No
No
No
No
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
...

result:

ok 3000 lines

Test #4:

score: 10
Accepted
time: 16ms
memory: 1228kb

input:

zzzyywwxyzxxyzyyzzyyyyzyyzyxxzzzzyyyyyxxyyzzyxxzzyyzzzyyzyyzzzzyyyyzzzxwwwwxzzzzyyzxxyyyzzyyyyyyzzzy...

output:

No
No
No
Yes
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
N...

result:

ok 3000 lines

Test #5:

score: 10
Accepted
time: 30ms
memory: 1228kb

input:

yxxyxxzzyyxxyyxxxxxxxwvuuxvvwyyxxxxyyyyxxwwxzyxxyxxyyyxwvuttywvvxxxywwxywwxxwuuuuzxxyxwwxvvwwuuvxyww...

output:

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

result:

ok 3000 lines

Test #6:

score: 10
Accepted
time: 33ms
memory: 1228kb

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:

ok 3000 lines

Test #7:

score: 0
Time Limit Exceeded

input:

yyzzzyyzzzyyzzzzyzzyyzyyzzyzzyzzzzyyzyyzzyzyzyyzyzyzzzzzzyzzyzzzyyyzyyzzyyyzzyzyyzzzyyzyyzzzyzyzyzyy...

output:

No
Yes
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
No
No...

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
Yes
No
Yes
Yes
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
Yes
No
No
No
No
No
Yes
No
No
Yes
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No...

result: