QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#276972#7894. Many Many HeadsSSH#WA 3ms3608kbC++20605b2023-12-06 14:04:012023-12-06 14:04:02

Judging History

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

  • [2023-12-06 14:04:02]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3608kb
  • [2023-12-06 14:04:01]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve();
signed main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	int T = 1;
	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}
void solve() {
	string s;
	cin >> s;
	int a0,a1,b0,b1;
	a0 = a1 = b0 = b1 = 0;
	int ca = 0, cb = 0;
	for(int i = 0; i < s.size();i++){
		if(s[i] == ')' || s[i] == '('){
			if(cb & 1)a1++;
			else a0++;
			ca++;
		}
		else{
			if(ca & 1)b1++;
			else b0++;
			cb++;
		}
	}
	if(a0 > 2 || a1 > 2 || b0 > 2 || b1 > 2){
		cout << "No\n";
	}
	else{
		cout << "Yes\n";
	}
}

详细

Test #1:

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

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

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: 3ms
memory: 3536kb

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

result:

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