QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#627128#7894. Many Many HeadsTytytony#WA 0ms3700kbC++23569b2024-10-10 14:52:232024-10-10 14:52:24

Judging History

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

  • [2024-10-10 14:52:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-10-10 14:52:23]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 1000010
using namespace std;

char a[N];
int cnt,tf;

int main(){
	int T; cin>>T;
	while(T--){
		cin>>a;
		cnt=0,tf=1;
		for(int i=0;a[i]!=0;i++){
			cnt++;
			if(a[i]==')') a[i]='(';
			if(a[i]==']') a[i]='[';
		}
		for(int i=0;i<cnt/2-1;i++){
			if(a[i]-a[i+1]==0) tf=0;
		}
		if(a[cnt/2-1]-a[cnt/2]) tf=0;
		for(int i=cnt/2;i<cnt-1;i++){
			if(a[i]-a[i+1]==0) tf=0;
		}
		if(tf) cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;

}

詳細信息

Test #1:

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

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

input:

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

output:

No
No

result:

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