QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#456629#7894. Many Many Headsmanhao#WA 11ms3712kbC++14648b2024-06-28 09:44:332024-06-28 09:44:33

Judging History

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

  • [2024-06-28 09:44:33]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:3712kb
  • [2024-06-28 09:44:33]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int T;
string s;
int main()
{
    cin >> T;
    while (T--)
    {
        cin >> s;
        int cnt1 = 0, cnt2 = 0;
        for (int i = 0; i < (int)s.length() - 1; i++)
        {
            if ((s[i] == '(' || s[i] == ')') && (s[i + 1] == '(' || s[i + 1] == ')'))
                cnt1++;
            if ((s[i] == '[' || s[i] == ']') && (s[i + 1] == '[' || s[i + 1] == ']'))
                cnt2++;
        }
        if (cnt1 <= 1 && cnt2 <= 1)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}

詳細信息

Test #1:

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

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

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: 11ms
memory: 3712kb

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]