QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394925 | #7894. Many Many Heads | ucup-team3294# | WA | 3ms | 3632kb | C++23 | 818b | 2024-04-20 21:56:04 | 2024-04-20 21:56:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int n;
string s;
cin>>s;
int cnt1=0,cnt2=0,cnt3=0,cnt4=0;
n=s.size();
s=' '+s;
bool flag1=false,flag2=false;
bool flag=false;
for(int i=1;i<=n;i++)
{
if(s[i]=='('||s[i]==')')
{
if(cnt2%2==0) cnt1++;
else cnt3++;
}
else
{
cnt2++;
}
}
if(cnt1>=4||cnt3>=4)
{
cout<<"No"<<endl;
return ;
}
flag1=false,flag2=false;
cnt1=0,cnt2=0;
cnt4=0,cnt3=0;
for(int i=1;i<=n;i++)
{
if(s[i]=='['||s[i]==']')
{
if(cnt1%2==0) cnt2++;
else cnt4++;
}
else
{
cnt1++;
}
}
if(cnt2>=4||cnt4>=4)
{
cout<<"No"<<endl;
return ;
}
else cout<<"Yes"<<endl;
}
signed main()
{
int T;
cin>>T;
while(T--)
{
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
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: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 (([([[([ ]]))])]])]
output:
Yes No
result:
ok 2 token(s): yes count is 1, no count is 1
Test #3:
score: -100
Wrong Answer
time: 3ms
memory: 3568kb
input:
15134 ][ )( )([[ [)([ )][) ]])( ([]([] ]]))][ [([](] ()[))] ][(]]( ([()[) ()[](( [)([)( ]]([[)]] )[()])]] ))[](([] ](([((]] ))[)][)[ [)])([(] [()[]))[ )][(]()] [[((]()] ((]])[[) ])(](]]) )]]()[]( ([)[])]) [[)[()]( ([[)[[() [[)([])) [)[[)[() ))[(([)( ()][)[](]] [()]([[([[ )[]))][)][ )]([]([(][ [])])(...
output:
Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No Yes No Yes No No Yes Yes No Yes No No Yes No Yes Yes No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No N...
result:
wrong answer expected YES, found NO [36th token]