QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#561679#7894. Many Many Headsrotcar07WA 0ms3788kbC++20669b2024-09-13 08:16:272024-09-13 08:16:28

Judging History

你现在查看的是最新测评结果

  • [2024-09-13 08:16:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3788kb
  • [2024-09-13 08:16:27]
  • 提交

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(auto x:s){
            int w=x;
            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=x;
        }
        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: 100
Accepted
time: 0ms
memory: 3788kb

input:

6
))
((()
[()]
()[()]()
([()])
([])([])

output:

Yes
No
Yes
No
Yes
No

result:

ok 6 token(s): yes count is 3, no count is 3

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

2
(([([[([
]]))])]])]

output:

No
No

result:

wrong answer expected YES, found NO [1st token]