QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#314212#7894. Many Many Headshy233WA 0ms3760kbC++14736b2024-01-25 14:25:082024-01-25 14:25:09

Judging History

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

  • [2024-01-25 14:25:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3760kb
  • [2024-01-25 14:25:08]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1000005;
const ll mod=998244353;
inline int rd()
{
	int x=0; bool f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())
		if(ch=='-') f=0;
	for(;ch>='0'&&ch<='9';ch=getchar())
		x=x*10+(ch^48);
	return f?x:-x;
}
#define ck(x) ((x)=='('||(x)==')')
char s[N];
int main()
{
	int t=rd();
	while(t--)
	{
		scanf("%s",s+1);
		int n=strlen(s+1);
		if(n&1)
		{
			printf("No\n");
			continue;
		}
		bool bb=1;
		for(int i=1;i<=n/2&&bb;i++)
			if(ck(s[i])!=ck(s[n-i+1]))
				bb=0;
		for(int i=2;i<=n/2&&bb;i++)
			if(ck(s[i])==ck(s[i-1]))
				bb=0;
		if(bb)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

詳細信息

Test #1:

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

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

input:

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

output:

No
No

result:

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