QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#626349 | #7894. Many Many Heads | ucup-team4906# | WA | 0ms | 3652kb | C++20 | 690b | 2024-10-10 05:23:12 | 2024-10-10 05:23:13 |
Judging History
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]