QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#418472#7894. Many Many HeadsHT008WA 8ms3956kbC++14572b2024-05-23 14:08:342024-05-23 14:08:35

Judging History

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

  • [2024-05-23 14:08:35]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3956kb
  • [2024-05-23 14:08:34]
  • 提交

answer

#include <string>
#include <iostream>
using namespace std;
void work()
{
	string s;
	cin>>s;
	int a=0,b=0;
	int t=0;
	bool flag=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='('||s[i]==')') t++;
		else
		{
			if(t%2) a++;
			else b++;
		}
	}
	if(a>=4||b>=4) flag=1;
	a=0,b=0;
	t=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]==']'||s[i]=='[') t++;
		else
		{
			if(t%2) a++;
			else b++;
		}
	}
	if(a>=4||b>=4) flag=1;
	if(flag) puts("No");
	else puts("Yes");
}
int main()
{
	int t;
	scanf("%d",&t);
	while(t--) work();
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3764kb

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

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

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

result:

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