QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#313949#7894. Many Many HeadsAlbert711WA 0ms3616kbC++14929b2024-01-25 10:40:552024-01-25 10:40:57

Judging History

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

  • [2024-01-25 10:40:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-01-25 10:40:55]
  • 提交

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]