QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#619385#7894. Many Many Headsqz2003WA 12ms3628kbC++20832b2024-10-07 14:03:392024-10-07 14:03:41

Judging History

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

  • [2024-10-07 14:03:41]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:3628kb
  • [2024-10-07 14:03:39]
  • 提交

answer

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int t;
int a[100005];
int main() {
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	cin>>t;
	while(t--){
		bool ok=1;
		stack<bool> l,r;
		string s;
		cin>>s;
		int len=s.size();
		for(int i=0;i<len;i++){
			if(s[i]=='('||s[i]==')'){
				a[i]=0;
			}
			else{
				a[i]=1;
			}
		}
		for(int i=1;i<len-1;i++){
			if(a[i]==a[i-1]&&a[i]==a[i+1]){
				ok=0;
				break;
			}
		}
		for(int i=0;i<len-3;i++){
			if(a[i]==a[i+1]&&a[i+2]==a[i+3]){
				if(a[i]!=a[i+2]){
					if(len>4){
						ok=0;
						break;
					}
				}
			}
		}
		for(int i=1;i<len/2;i++){
			if(a[i]==a[i-1]&&a[len-i-1]==a[len-i]&&a[i]==a[len-i]){
				ok=0;
				break;
			}
		}
		if(ok){
			cout<<"Yes\n";
		}
		else{
			cout<<"No\n";
		}
	}
	return 0;
}

详细

Test #1:

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

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: 0
Accepted
time: 0ms
memory: 3480kb

input:

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

output:

Yes
No

result:

ok 2 token(s): yes count is 1, no count is 1

Test #3:

score: -100
Wrong Answer
time: 12ms
memory: 3628kb

input:

15134
][
)(
)([[
[)([
)][)
]])(
([]([]
]]))][
[([](]
()[))]
][(]](
([()[)
()[]((
[)([)(
]]([[)]]
)[()])]]
))[](([]
](([((]]
))[)][)[
[)])([(]
[()[]))[
)][(]()]
[[((]()]
((]])[[)
])(](]])
)]]()[](
([)[])])
[[)[()](
([[)[[()
[[)([]))
[)[[)[()
))[(([)(
()][)[](]]
[()]([[([[
)[]))][)][
)]([]([(][
[])])(...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
Yes
No
Yes
No
No
Yes
No
Yes
Yes
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
No
Yes
Yes
No
No
No
No
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
No
No
No
No
No
Yes
No
Yes
No
Yes
No
Yes
Yes
No
No
No
Yes
No
No
Yes
No
No
...

result:

wrong answer expected NO, found YES [34th token]