QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#313946#7894. Many Many HeadsAlbert711WA 0ms3608kbC++14929b2024-01-25 10:39:002024-01-25 10:39:01

Judging History

你现在查看的是最新测评结果

  • [2024-01-25 10:39:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3608kb
  • [2024-01-25 10:39:00]
  • 提交

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>=2||j3>=2) {
        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;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3604kb

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: 3548kb

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: 0ms
memory: 3608kb

input:

15134
][
)(
)([[
[)([
)][)
]])(
([]([]
]]))][
[([](]
()[))]
][(]](
([()[)
()[]((
[)([)(
]]([[)]]
)[()])]]
))[](([]
](([((]]
))[)][)[
[)])([(]
[()[]))[
)][(]()]
[[((]()]
((]])[[)
])(](]])
)]]()[](
([)[])])
[[)[()](
([[)[[()
[[)([]))
[)[[)[()
))[(([)(
()][)[](]]
[()]([[([[
)[]))][)][
)]([]([(][
[])])(...

output:

Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
No
Yes
No
No
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
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No...

result:

wrong answer expected YES, found NO [7th token]