QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425902#7894. Many Many HeadsRepeater#WA 0ms3612kbC++20483b2024-05-30 18:43:202024-05-30 18:43:20

Judging History

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

  • [2024-05-30 18:43:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-05-30 18:43:20]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

void repeater()
{
	std::string s; std::cin >> s;

	for(auto &i : s)
	{
		if(i == ')') i = '(';
		if(i == ']') i = '[';
	}

	int cnt = 0;
	for(int i = 1; i < s.size(); i++)
		if(s[i] == s[i - 1]) cnt++;

	if(cnt >= 2) std::cout << "No\n";
	else std::cout << "Yes\n";
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int t; std::cin >> t;
	while(t--) repeater();

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: -100
Wrong Answer
time: 0ms
memory: 3548kb

input:

2
(([([[([
]]))])]])]

output:

No
No

result:

wrong answer expected YES, found NO [1st token]