QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#499579 | #7894. Many Many Heads | Savior | WA | 10ms | 3620kb | C++20 | 769b | 2024-07-31 15:54:38 | 2024-07-31 15:54:38 |
Judging History
answer
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
#define int long long
using ll=long long;
const int inf=1e9+7,N=50+5,mod=1e9+7;
typedef pair<int,int>P;
void solve(){
string s;cin>>s;
int n=s.length();s=" "+s;
int num=0;
for(int i=1;i<=n;i++){
if(abs(s[i+1]-s[i])<=2){
int cnt=0;
while(s[i]==s[i+1]) i+=1,cnt+=1;
if(cnt>=2){
cout<<"No"<<endl;
return;
}
else num+=1;
}
}
if(num>=3) cout<<"No"<<endl;
else cout<<"Yes"<<endl;
return;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int t=1;cin>>t;
while(t--)solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
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: 0
Accepted
time: 0ms
memory: 3524kb
input:
2 (([([[([ ]]))])]])]
output:
Yes No
result:
ok 2 token(s): yes count is 1, no count is 1
Test #3:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
15134 ][ )( )([[ [)([ )][) ]])( ([]([] ]]))][ [([](] ()[))] ][(]]( ([()[) ()[](( [)([)( ]]([[)]] )[()])]] ))[](([] ](([((]] ))[)][)[ [)])([(] [()[]))[ )][(]()] [[((]()] ((]])[[) ])(](]]) )]]()[]( ([)[])]) [[)[()]( ([[)[[() [[)([])) [)[[)[() ))[(([)( ()][)[](]] [()]([[([[ )[]))][)][ )]([]([(][ [])])(...
output:
Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No Yes No Yes No No Yes Yes No Yes No No Yes No Yes Yes No No Yes No No No No Yes No No No No No No Yes No No Yes Yes No No No Yes No No No No Yes No No No Yes Yes No No Yes No No No No No No Yes No No No No No No No No No No Yes No No No No No No No No...
result:
ok 15134 token(s): yes count is 132, no count is 15002
Test #4:
score: -100
Wrong Answer
time: 10ms
memory: 3484kb
input:
100000 ][[][[ ())))( )()))) ]]][[[ )[]))( ()[[)( )()))) [[[][] [][][] ))[]]] ]]]][[ ][]]][ (][))) ((([]( ][[]]] )([)([ ))()(( [)[[)[ ((())) )(][[] ][[[[[ ()(((( ][][]] ][)()( ]]]]][ (()(() )([((] [][[]] ]][]][ )((()) ][[[[[ [)[[([ (([[)( (((()) )((()( ))()() ()(((( [[][][ ))[])( (((()( ]]][[] ()[[]]...
output:
No No No No Yes No No No No No No No No No No Yes No Yes No No No No No No No No Yes 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 Yes Yes No No No Yes No No Yes 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 No No No Yes No No N...
result:
wrong answer expected NO, found YES [5th token]