QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#275592#7894. Many Many HeadszyyscjWA 7ms3468kbC++14693b2023-12-04 21:13:202023-12-04 21:13:20

Judging History

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

  • [2023-12-04 21:13:20]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3468kb
  • [2023-12-04 21:13:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;
stack<PII>st;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		string s;
		cin >> s;
		int num0 = 0;
		int num1 = 0;
		for(int j = 0; j < s.size(); j++)
		{
			if(s[j] == '[' || s[j] == ']')
			{
				num1++;
			}
			else
			{
				if(num1 % 2 == 0) num0++;
			}
		}
		if(num0 >= 3)
		{
			cout<<"No\n";
			continue;
		}
	    num0 = 0;
		num1 = 0;
		for(int j = 0; j < s.size(); j++)
		{
			if(s[j] == '(' || s[j] == ')')
			{
				num0++;
			}
			else
			{
				if(num0 % 2 == 0) num1++;
			}
		}
		if(num1 >= 3)
		{
			cout<<"No\n";
			continue;
		}
		cout << "Yes\n";
	}
}

详细

Test #1:

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

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

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

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]