QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#637970 | #7894. Many Many Heads | Etha# | WA | 0ms | 3860kb | C++14 | 465b | 2024-10-13 14:30:07 | 2024-10-13 14:30:07 |
Judging History
answer
#include<iostream>
#include<cstdio>
#define N 100100
using namespace std;
int a[N];
int main(){
int t;
cin>>t;
string str;
while(t--){
cin>>str;
int len = str.length();
for (int i=0;i<len;i++){
if(str[i]=='('||str[i]==')') a[i+1]=1;
else a[i+1]=2;
}
int flag=0;
for(int i=1;i<=len/2;i++){
if(a[i]!=a[len+1-i]||a[i]==a[i-1]) flag=1;
}
if(!flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
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: 3824kb
input:
2 (([([[([ ]]))])]])]
output:
No No
result:
wrong answer expected YES, found NO [1st token]