QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#543152 | #7894. Many Many Heads | New_Folder# | WA | 0ms | 3616kb | C++14 | 757b | 2024-09-01 14:29:53 | 2024-09-01 14:29:53 |
Judging History
answer
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define int long long
//#define pi 3.1415926
typedef long long ll;
using namespace std;
int mod=998244353;
int fp(int a,int b){
int ans=1;
while(b){
if(b&1) ans*=a,ans%=mod;
a*=a,a%=mod;
b>>=1;
}
return ans;
}
void solve(){
string str;
cin>>str;bool ans=1;
int len=str.length();
bool flag=0;
if(str[0]=='('||str[0]==')') flag=1;
for(int i=1;i<=len/2-1;i++){
if(str[i]=='('||str[i]==')'){
if(flag) ans=0;
else flag=1;
}
else{
if(!flag) ans=0;
else flag=0;
}
}
if(ans) cout<<"Yes\n";
else cout<<"No\n";
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t;cin>>t;while(t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
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: 3532kb
input:
2 (([([[([ ]]))])]])]
output:
No No
result:
wrong answer expected YES, found NO [1st token]