QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#706258#7894. Many Many Headsq1w2e3r4#WA 0ms3688kbC++14614b2024-11-03 09:48:112024-11-03 09:48:12

Judging History

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

  • [2024-11-03 09:48:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3688kb
  • [2024-11-03 09:48:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e6 + 10;
string str;
int a[MAXN];
void prepare(){
    cin >> str;
    int N = str.size();
    for(int i = 1; i <= N; i++){
        if(str[i-1] == '(' || str[i-1] == ')') a[i] = 1;
        else a[i] = 2;
    }
    int cnt = 0;
    for(int i = 2; i <= N; i++){
        if(a[i] == a[i-1]){
            cnt++;
        }
    }
    if(cnt == 1) cout << "Yes\n";
    else cout << "No\n";
}

signed main(){
    ios::sync_with_stdio(false);
    int T;
    cin >> T;
    while(T--){
        prepare();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

2
(([([[([
]]))])]])]

output:

No
No

result:

wrong answer expected YES, found NO [1st token]