ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213991 | #2739. 阿空的核聚变 | Filberte | 0 | 67ms | 1204kb | C++11 | 809b | 2024-11-14 21:48:37 | 2024-11-14 23:08:31 |
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 5e5 + 100;
char c[N], st[N];int tp;
ll s[N];
bool chk(int l, int r){
tp = 0;
for(int i = l;i <= r;i++){
st[++tp] = c[i];
while(tp >= 2 && st[tp] == st[tp - 1]){
tp -= 2;
if(st[tp + 1] != 'z') st[++tp]++;
}
}
return (tp == 0);
}
int main(){
scanf("%s",c + 1);
int n = strlen(c + 1);
for(int i = 1;i <= n;i++) s[i] = (1 << (c[i] - 'a'));
ll dn = (1 << 26);
int q;scanf("%d",&q);
while(q--){
int l, r;scanf("%d%d",&l,&r);
if((s[r] - s[l]) % dn == 0){
puts("No");
continue;
}
else if(chk(l, r)) puts("Yes");
else puts("No");
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1180kb
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 182nd lines differ - expected: 'Yes', found: 'No'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1180kb
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: 1ms
memory: 1176kb
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: 13ms
memory: 1204kb
input:
zzzyywwxyzxxyzyyzzyyyyzyyzyxxzzzzyyyyyxxyyzzyxxzzyyzzzyyzyyzzzzyyyyzzzxwwwwxzzzzyyzxxyyyzzyyyyyyzzzy...
output:
No No No Yes No Yes No No No No No No No No No No No Yes No No No No No No No No No No Yes No No No ...
result:
wrong answer 9th lines differ - expected: 'Yes', found: 'No'
Test #5:
score: 0
Wrong Answer
time: 25ms
memory: 1200kb
input:
yxxyxxzzyyxxyyxxxxxxxwvuuxvvwyyxxxxyyyyxxwwxzyxxyxxyyyxwvuttywvvxxxywwxywwxxwuuuuzxxyxwwxvvwwuuvxyww...
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 19th lines differ - expected: 'Yes', found: 'No'
Test #6:
score: 0
Wrong Answer
time: 28ms
memory: 1204kb
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 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:
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 No No No No No ...
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 No No No No Yes No No No No Yes No No No No No ...