QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#627348#7894. Many Many HeadsYurily#WA 0ms3820kbC++20931b2024-10-10 15:36:502024-10-10 15:36:51

Judging History

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

  • [2024-10-10 15:36:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2024-10-10 15:36:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int  n;
string s;
bool check1(){
	for(int i=0;i<=n/2-1;++i){
		if(i%2==0){
			if(s[i]=='('||s[i]==')')
				return 0;
		}
		else{
			if(s[i]=='['||s[i]==']')
				return 0;
		}
	}
	for(int i=n/2;i<=n-1;++i){
		if(i%2==1){
			if(s[i]=='('||s[i]==')')
				return 0;
		}
		else{
			if(s[i]=='['||s[i]==']')
				return 0;
		}
	}
	return 1;
}
bool check2(){
	for(int i=0;i<=n/2-1;++i){
		if(i%2==1){
			if(s[i]=='('||s[i]==')')
				return 0;
		}
		else{
			if(s[i]=='['||s[i]==']')
				return 0;
		}
	}
	for(int i=n/2;i<=n-1;++i){
		if(i%2==0){
			if(s[i]=='('||s[i]==')')
				return 0;
		}
		else{
			if(s[i]=='['||s[i]==']')
				return 0;
		}
	}	
	return 1;
}
void solve(){
	cin>>s;
	n=s.size();
	if(check1()||check2()){
		printf("Yes\n");
	}
	else
		printf("No\n");
}
int main(){
	int T;
	cin>>T;
	while(T--){
		solve();
	}
}

詳細信息

Test #1:

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

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

input:

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

output:

No
No

result:

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