ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#213971 | #2739. 阿空的核聚变 | White_Wat | 0 | 1168ms | 9480kb | C++ | 874b | 2024-11-14 20:36:40 | 2024-11-14 23:06:07 |
answer
#include<bits/stdc++.h>
using namespace std;
const int L = 500010, mod = 1e9+7, bit = 13331;
typedef long long ll;
string s;
int a[L];
int len;
int n;
int l,r;
ll h[L];
int re[L];
typedef pair<int,int> pii;
stack<pii> st;
void init(){
st.push({0,0});
for(int i=1;i<=len;i++){
int now=a[i];
while(st.size()&&st.top().first==now){
now++;
st.pop();
}
// cout<<now<<' '<<st.top().second<<'\n';
re[i]=st.top().second;
if(now==27){
h[i]=h[st.top().second];
continue;
}
h[i]=h[st.top().second]*bit+now;
st.push({now,i});
}
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>s>>n;
len=s.size();
s=' '+s;
for(int i=1;i<=len;i++)
a[i]=s[i]-'a'+1;
init();
while(n--){
cin>>l>>r;
if(h[r]==h[l-1]&&re[r]<l)
cout<<"Yes\n";
else
cout<<"No\n";
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1248kb
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 79th lines differ - expected: 'No', found: 'Yes'
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 1252kb
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: 0ms
memory: 1248kb
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:
wrong answer 75th lines differ - expected: 'Yes', found: 'No'
Test #4:
score: 0
Wrong Answer
time: 1ms
memory: 1304kb
input:
zzzyywwxyzxxyzyyzzyyyyzyyzyxxzzzzyyyyyxxyyzzyxxzzyyzzzyyzyyzzzzyyyyzzzxwwwwxzzzzyyzxxyyyzzyyyyyyzzzy...
output:
No No No Yes No Yes No No Yes No Yes No No No No No Yes Yes No No No No No No No No No No Yes No No ...
result:
wrong answer 17th lines differ - expected: 'No', found: 'Yes'
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1304kb
input:
yxxyxxzzyyxxyyxxxxxxxwvuuxvvwyyxxxxyyyyxxwwxzyxxyxxyyyxwvuttywvvxxxywwxywwxxwuuuuzxxyxwwxvvwwuuvxyww...
output:
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 No No No No No No No ...
result:
wrong answer 2nd lines differ - expected: 'Yes', found: 'No'
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1300kb
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 138th lines differ - expected: 'Yes', found: 'No'
Test #7:
score: 0
Wrong Answer
time: 186ms
memory: 9476kb
input:
yyzzzyyzzzyyzzzzyzzyyzyyzzyzzyzzzzyyzyyzzyzyzyyzyzyzzzzzzyzzyzzzyyyzyyzzyyyzzyzyyzzzyyzyyzzzyzyzyzyy...
output:
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 No No No No No No ...
result:
wrong answer 2nd lines differ - expected: 'Yes', found: 'No'
Test #8:
score: 0
Wrong Answer
time: 259ms
memory: 9476kb
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 Yes No No No No ...
result:
wrong answer 27th lines differ - expected: 'Yes', found: 'No'
Test #9:
score: 0
Wrong Answer
time: 382ms
memory: 9476kb
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:
wrong answer 63rd lines differ - expected: 'Yes', found: 'No'
Test #10:
score: 0
Wrong Answer
time: 339ms
memory: 9480kb
input:
ywwxyyxxyzzzyxxyyyyzzzzzzyyzzyxxzzyyyxxzzzywwxzzyyzwwxxwwyyzyyzzzyyzyyyxwwyxxyyzyyyxxyyzyxxyyzzywwxw...
output:
No No No No No No No No Yes No No No No No Yes No No No No No No Yes No No No No Yes No No No No No ...
result:
wrong answer 18th lines differ - expected: 'Yes', found: 'No'