QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#314334 | #7894. Many Many Heads | Kazdale | WA | 0ms | 3584kb | C++14 | 655b | 2024-01-25 15:41:56 | 2024-01-25 15:41:57 |
Judging History
answer
#include <iostream>
using namespace std;
constexpr int MAXN(1000007);
string s;
int T, cntf, cnty;
inline void read(int &temp) { cin >> temp; }
inline void work() {
cin >> s, cntf = cnty = 0;
for (int i(0); i < (int)s.length() - 1; ++i) {
if (s[i] == '[' || s[i] == ']')
if (s[i + 1] == '[' || s[i + 1] == ']') ++cntf;
if (s[i] == '(' || s[i] == ')')
if (s[i + 1] == '(' || s[i + 1] == ')') ++cnty;
}
if (cntf <= 2 && cnty <= 2) return cout << "Yes" << endl, void();
cout << "No" << endl;
}
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
read(T);
while (T--) work();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
6 )) ((() [()] ()[()]() ([()]) ([])([])
output:
Yes No Yes No Yes Yes
result:
wrong answer expected NO, found YES [6th token]