QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#657561 | #7894. Many Many Heads | 336699go# | WA | 0ms | 3660kb | C++17 | 745b | 2024-10-19 14:59:18 | 2024-10-19 14:59:18 |
Judging History
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]