QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#657561#7894. Many Many Heads336699go#WA 0ms3660kbC++17745b2024-10-19 14:59:182024-10-19 14:59:18

Judging History

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

  • [2024-10-19 14:59:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3660kb
  • [2024-10-19 14:59:18]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

int t{};
string s;
int a[100005]{};

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> t;
    while(t--) {
        cin >> s;

        for (int i = 0; i < s.size(); i++) {
            if (s.at(i) == '(' || s.at(i) == ')') {
                a[i] = 1;
            } else {
                a[i] = 2;
            }
        }

        int flag = false;

        for (int i = 1; i < s.size() / 2; i++) {
            if (a[i] == a[i - 1]) {
                flag = true;
                break;
            }
        }

        if (flag) {
            cout << "No\n";
        } else {
            cout << "Yes\n";
        }
    }
}

詳細信息

Test #1:

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

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

input:

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

output:

No
No

result:

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