QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#637970#7894. Many Many HeadsEtha#WA 0ms3860kbC++14465b2024-10-13 14:30:072024-10-13 14:30:07

Judging History

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

  • [2024-10-13 14:30:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3860kb
  • [2024-10-13 14:30:07]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define N 100100
using namespace std;
int a[N];
int main(){
	int t;
	cin>>t;
	string str;
	while(t--){
		cin>>str;
		int len = str.length();
		for (int i=0;i<len;i++){
			if(str[i]=='('||str[i]==')') a[i+1]=1;
			else a[i+1]=2;
		}
		int flag=0;
		for(int i=1;i<=len/2;i++){
			if(a[i]!=a[len+1-i]||a[i]==a[i-1]) flag=1;
		}
		if(!flag) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		
	} 
	return 0;
}


詳細信息

Test #1:

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

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

input:

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

output:

No
No

result:

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