ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213984 | #2739. 阿空的核聚变 | White_Wat | 60 | 148ms | 1260kb | C++ | 720b | 2024-11-14 21:13:37 | 2024-11-14 23:07:26 |
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 5e5+5;
string s;
int len;
int a[N];
int m;
stack<int> st;
bool solve(int l,int r){
while(st.size()) st.pop();
for(int i=l;i<=r;i++){
// cout<<s[i-1];
int now=a[i];
while(st.size()&&now==st.top()){
now++;
st.pop();
}
if(now==27)
continue;
st.push(now);
}
return st.size();
}
int main(){
// freopen("2.in","r",stdin);
// freopen("B.out","w",stdout);
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// cout<<'?';
cin>>s>>m;len=s.size();
for(int i=1;i<=len;i++)
a[i]=s[i-1]-'a'+1;
while(m--){
int l,r;cin>>l>>r;
if(!solve(l,r)) cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 3ms
memory: 1244kb
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: 3ms
memory: 1244kb
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: 1240kb
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: 37ms
memory: 1256kb
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: 54ms
memory: 1260kb
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: 49ms
memory: 1260kb
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...