QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#626349#7894. Many Many Headsucup-team4906#WA 0ms3652kbC++20690b2024-10-10 05:23:122024-10-10 05:23:13

Judging History

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

  • [2024-10-10 05:23:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-10-10 05:23:12]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

void sol()
{
    string s;
    cin >> s;
    int n = s.length();
    s = "0" + s;
    for (int i = 1; i <= n; i ++) if (s[i] == ')') s[i] = '('; else if (s[i] == ']') s[i] = '[';
    for (int i = 1; i < n / 2; i ++) if (s[i] == s[i + 1]) {cout << "No\n"; return ;}
    if (s[n / 2] != s[n / 2 + 1]) {cout << "No\n"; return ;}
    for (int i = n / 2 + 1; i < n; i ++) if (s[i] == s[i + 1]) {cout << "No\n"; return ;}
    cout << "Yes\n";
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int T = 1;
    cin >> T;
    while (T --) sol();
    return 0;
}

詳細信息

Test #1:

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

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

input:

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

output:

No
No

result:

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