QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#275601 | #7894. Many Many Heads | zyyscj | WA | 0ms | 3428kb | C++14 | 725b | 2023-12-04 21:19:54 | 2023-12-04 21:19:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;
stack<PII>st;
int main()
{
int t;
cin >> t;
while(t--)
{
string s;
cin >> s;
int num0 = 0;
int num1 = 0;
bool ok0 = 0;
bool ok1 = 0;
for(int j = 0; j < s.size(); j++)
{
if(s[j] == '[' || s[j] == ']')
{
num1++;
}
else
{
if(num1 % 2 == 0) num0++;
}
}
if(num0 >= 3)
{
ok0 = 1;
}
num0 = 0;
num1 = 0;
for(int j = 0; j < s.size(); j++)
{
if(s[j] == '(' || s[j] == ')')
{
num0++;
}
else
{
if(num0 % 2 == 0) num1++;
}
}
if(num1 >= 3)
{
ok1 = 1;
}
if(ok0 && ok1)cout<<"No\n";
else cout << "Yes\n";
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3428kb
input:
6 )) ((() [()] ()[()]() ([()]) ([])([])
output:
Yes Yes Yes Yes Yes Yes
result:
wrong answer expected NO, found YES [2nd token]