QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#561137#7894. Many Many HeadssmlWA 0ms3832kbC++17451b2024-09-12 20:34:272024-09-12 20:34:27

Judging History

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

  • [2024-09-12 20:34:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-09-12 20:34:27]
  • 提交

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;
}

詳細信息

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]