QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#627128 | #7894. Many Many Heads | Tytytony# | WA | 0ms | 3700kb | C++23 | 569b | 2024-10-10 14:52:23 | 2024-10-10 14:52:24 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 1000010
using namespace std;
char a[N];
int cnt,tf;
int main(){
int T; cin>>T;
while(T--){
cin>>a;
cnt=0,tf=1;
for(int i=0;a[i]!=0;i++){
cnt++;
if(a[i]==')') a[i]='(';
if(a[i]==']') a[i]='[';
}
for(int i=0;i<cnt/2-1;i++){
if(a[i]-a[i+1]==0) tf=0;
}
if(a[cnt/2-1]-a[cnt/2]) tf=0;
for(int i=cnt/2;i<cnt-1;i++){
if(a[i]-a[i+1]==0) tf=0;
}
if(tf) cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
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: 3700kb
input:
2 (([([[([ ]]))])]])]
output:
No No
result:
wrong answer expected YES, found NO [1st token]