QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#561684 | #7894. Many Many Heads | rotcar07 | WA | 0ms | 3552kb | C++20 | 688b | 2024-09-13 08:19:27 | 2024-09-13 08:19:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
string s;cin>>s;
int sb[3]={};
int lst=s[0],cnt=0;
for(int i=1;i+1<s.size();i++){
int w=s[i];
if(abs(w-lst)<=2) cnt++;
else{
if(cnt>=3){cout<<"No\n";goto fail;}
sb[cnt]++;
cnt=1;
}
// cout<<w<<' '<<lst<<' '<<abs(w-lst)<<' '<<cnt<<'\n';
lst=w;
}
if(cnt>=3){cout<<"No\n";goto fail;}
sb[cnt]++;
cnt=1;
if(sb[2]>=2) cout<<"No\n";
else cout<<"Yes\n";
fail:;
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
6 )) ((() [()] ()[()]() ([()]) ([])([])
output:
Yes Yes Yes Yes Yes No
result:
wrong answer expected NO, found YES [2nd token]