QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#601398#7894. Many Many HeadsinoaderWA 7ms3720kbC++14791b2024-09-29 22:58:442024-09-29 22:58:44

Judging History

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

  • [2024-09-29 22:58:44]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3720kb
  • [2024-09-29 22:58:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
inline int read(){
	int x=0,k=1;char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')k=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return x*k;
}
string s;
void sol(){
	cin>>s;
	int a=0,b=0;
	for(char c:s){
		if(c=='('||c==')')++a,b=0;
		else ++b,a=0;
		if(a>2||b>2){
			puts("No");
			return;
		}
	}
	a=0,b=0;
	for(char c:s){
		if(c=='('||c==')'){
			if(b==0)++a;
		}
		else b^=1;
		if(a>2){
			puts("No");
			return;
		}
	}
	a=0,b=0;
	for(char c:s){
		if(c=='['||c==']'){
			if(b==0)++a;
		}
		else b^=1;
		if(a>2){
			puts("No");
			return;
		}
	}
	puts("Yes");
}
signed main(){
	int T=read();
	while(T--)sol(); 
}

詳細信息

Test #1:

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

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

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: 7ms
memory: 3704kb

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
No
No
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
...

result:

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