QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#396806 | #5534. Match | sichengzhou# | 0 | 0ms | 3804kb | C++14 | 901b | 2024-04-23 10:59:51 | 2024-07-04 03:36:55 |
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%