QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#561679 | #7894. Many Many Heads | rotcar07 | WA | 0ms | 3788kb | C++20 | 669b | 2024-09-13 08:16:27 | 2024-09-13 08:16: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(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:;
}
}
Details
Tip: Click on the bar to expand more detailed information
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]