QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#275601#7894. Many Many HeadszyyscjWA 0ms3428kbC++14725b2023-12-04 21:19:542023-12-04 21:19:56

Judging History

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

  • [2023-12-04 21:19:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3428kb
  • [2023-12-04 21:19:54]
  • 提交

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;
		bool ok0 = 0;
		bool ok1 = 0;
		for(int j = 0; j < s.size(); j++)
		{
			if(s[j] == '[' || s[j] == ']')
			{
				num1++;
			}
			else
			{
				if(num1 % 2 == 0) num0++;
			}
		}
		if(num0 >= 3)
		{
			ok0 = 1;
		}
	    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)
		{
			ok1 = 1;
		}
		if(ok0 && ok1)cout<<"No\n";
		else cout << "Yes\n";
	}
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3428kb

input:

6
))
((()
[()]
()[()]()
([()])
([])([])

output:

Yes
Yes
Yes
Yes
Yes
Yes

result:

wrong answer expected NO, found YES [2nd token]