QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#313949 | #7894. Many Many Heads | Albert711 | WA | 0ms | 3616kb | C++14 | 929b | 2024-01-25 10:40:55 | 2024-01-25 10:40:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int N = 1000 + 5;
#define int long long
const int mod = 1000000000;
void solve() {
string s;
cin>>s;
int j1=0,j2=0,j3=0;
int len=s.length();
for(int i=0;i<len;i++){
if(s[i]==')') s[i]='(';
else if(s[i]==']') s[i]='[';
}
s.push_back('?');
s.push_back('?');
for(int i=0;i<len;i++){
if(s[i]=='('&&s[i+1]=='('&&s[i+2]=='(') j1=1;
if(s[i]=='('&&s[i+1]=='(') j2++;
if(s[i]=='['&&s[i+1]=='['&&s[i+2]=='[') j1=1;
if(s[i]=='['&&s[i+1]=='[') j3++;
}
if(j1==1||j2>=3||j3>=3) {
cout<<"No\n";
}else{
cout<<"Yes\n";
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
cin >> T;
while (T--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3616kb
input:
6 )) ((() [()] ()[()]() ([()]) ([])([])
output:
Yes No Yes No Yes Yes
result:
wrong answer expected NO, found YES [6th token]