QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#561137 | #7894. Many Many Heads | sml | WA | 0ms | 3832kb | C++17 | 451b | 2024-09-12 20:34:27 | 2024-09-12 20:34:27 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve()
{
string s;
cin>>s;
for(auto &i:s){
if(i==')') i='(';
if(i==']') i='[';
}
int cnt=0;
for(int i=1;i<s.size();i++) if(s[i]==s[i-1]) cnt++;
if(cnt<2) cout<<"Yes"<<'\n';
else cout<<"No"<<'\n';
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int t;
cin>>t;
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3832kb
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: 3776kb
input:
2 (([([[([ ]]))])]])]
output:
No No
result:
wrong answer expected YES, found NO [1st token]