QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#314324#7894. Many Many HeadsKazdaleWA 4ms3672kbC++14655b2024-01-25 15:38:112024-01-25 15:38:12

Judging History

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

  • [2024-01-25 15:38:12]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3672kb
  • [2024-01-25 15:38:11]
  • 提交

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 <= 1 && cnty <= 1)  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: 100
Accepted
time: 0ms
memory: 3672kb

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

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: 4ms
memory: 3672kb

input:

15134
][
)(
)([[
[)([
)][)
]])(
([]([]
]]))][
[([](]
()[))]
][(]](
([()[)
()[]((
[)([)(
]]([[)]]
)[()])]]
))[](([]
](([((]]
))[)][)[
[)])([(]
[()[]))[
)][(]()]
[[((]()]
((]])[[)
])(](]])
)]]()[](
([)[])])
[[)[()](
([[)[[()
[[)([]))
[)[[)[()
))[(([)(
()][)[](]]
[()]([[([[
)[]))][)][
)]([]([(][
[])])(...

output:

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

result:

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