QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#554352 | #7894. Many Many Heads | liqingyang# | WA | 0ms | 3624kb | C++14 | 648b | 2024-09-09 10:35:29 | 2024-09-09 10:35:29 |
Judging History
answer
#include<iostream>
#include<cstring>
using namespace std;
int T;
char s[100010];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>T;
while(T--)
{
cin>>s+1;
int n=strlen(s+1);
for(int i=1;i<=n;i++)
{
if(s[i]==')')
{
s[i]='(';
}
if(s[i]==']')
{
s[i]='[';
}
}
bool flag=1;
for(int i=2;i<=(n>>1);i++)
{
if(s[i]==s[i-1])
{
flag=0;
break;
}
}
if(s[n>>1]!=s[(n>>1)+1])
{
flag=0;
}
for(int i=(n>>1)+2;i<=n;i++)
{
if(s[i]==s[i-1])
{
flag=0;
break;
}
}
cout<<(flag?"Yes":"No")<<'\n';
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
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: 3560kb
input:
2 (([([[([ ]]))])]])]
output:
No No
result:
wrong answer expected YES, found NO [1st token]