QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#396806#5534. Matchsichengzhou#0 0ms3804kbC++14901b2024-04-23 10:59:512024-07-04 03:36:55

Judging History

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

  • [2024-07-04 03:36:55]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3804kb
  • [2024-04-23 10:59:51]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,f[N],stk[N],tp;
char ch[N];
int main()
{
    scanf("%s",ch);
    n=strlen(ch);
    for(int i=0;i<(1<<n);i++)
    {
        bool fl=1;tp=0;
        for(int j=0;j<n;j++)
        {
            if(i>>j&1)
            {
                if(stk[tp]==ch[j]-'0')
                {
                    tp--;
                }else{
                    fl=0;
                    break;
                }
            }else{
                stk[++tp]=ch[j]-'0';
            }
        }
        if(fl&&tp==0)
        {
            for(int j=0;j<n;j++)
            {
                if(i>>j&1)
                {
                    printf(")");
                }else{
                    printf("(");
                }
            }
            return 0;
        }
    }
    printf("-1");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3804kb

input:

abbaaa

output:

(())()

result:

wrong answer 1st lines differ - expected: '(()())', found: '(())()'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%