QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#314334#7894. Many Many HeadsKazdaleWA 0ms3584kbC++14655b2024-01-25 15:41:562024-01-25 15:41:57

Judging History

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

  • [2024-01-25 15:41:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2024-01-25 15:41:56]
  • 提交

answer

#include <iostream>
using namespace std;
constexpr int MAXN(1000007);
string s;
int T, cntf, cnty;
inline void read(int &temp) { cin >> temp; }
inline void work() {
	cin >> s, cntf = cnty = 0;
	for (int i(0); i < (int)s.length() - 1; ++i) {
		if (s[i] == '[' || s[i] == ']')
			if (s[i + 1] == '[' || s[i + 1] == ']')  ++cntf;
		if (s[i] == '(' || s[i] == ')')
			if (s[i + 1] == '(' || s[i + 1] == ')')  ++cnty;
	}
	if (cntf <= 2 && cnty <= 2)  return cout << "Yes" << endl, void();
	cout << "No" << endl;
}
int main() {
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	read(T);
	while (T--)  work();
	return 0;
}

详细

Test #1:

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

input:

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

output:

Yes
No
Yes
No
Yes
Yes

result:

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