QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#554352#7894. Many Many Headsliqingyang#WA 0ms3624kbC++14648b2024-09-09 10:35:292024-09-09 10:35:29

Judging History

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

  • [2024-09-09 10:35:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-09-09 10:35:29]
  • 提交

answer

#include<iostream>
#include<cstring>
using namespace std;
int T;
char s[100010];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>T;
	while(T--)
	{
		cin>>s+1;
		int n=strlen(s+1);
		for(int i=1;i<=n;i++)
		{
			if(s[i]==')')
			{
				s[i]='(';
			}
			if(s[i]==']')
			{
				s[i]='[';
			}
		}
		bool flag=1;
		for(int i=2;i<=(n>>1);i++)
		{
			if(s[i]==s[i-1])
			{
				flag=0;
				break;
			}
		}
		if(s[n>>1]!=s[(n>>1)+1])
		{
			flag=0;
		}
		for(int i=(n>>1)+2;i<=n;i++)
		{
			if(s[i]==s[i-1])
			{
				flag=0;
				break;
			}
		}
		cout<<(flag?"Yes":"No")<<'\n';
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

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: 3560kb

input:

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

output:

No
No

result:

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