QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#800592 | #7683. Hard Brackets Problem | UESTC_DebugSimulator# | WA | 12ms | 3636kb | C++17 | 406b | 2024-12-06 13:09:53 | 2024-12-06 13:09:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
string work(){
string s;
cin>>s;
int fl=0;
string ans;
for(auto c:s){
if(c=='('){
fl++;
ans+='(';
}
if(c==')'){
if(fl==0)ans+=')';
else fl--;
}
}
if(fl>0)return "impossible";
return ans;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin>>T;
while(T--)cout<<work()<<"\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
3 ((())) ( )))()
output:
((( impossible )))(
result:
ok 3 cases (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 12ms
memory: 3540kb
input:
100000 ())(()()() ()())())) )()()()() ())()(())( ((())())) )(())()))( )()))()))) )))))(((() ()))((()(( ()((()())) (()())()) ())(()))() (())(()))) ))))(()(() ()))(())(( ()((())()) ()))()))() ()((())()) ()()))((() ()))(())) (()(()))) ())((())) ())()((()) (()(()))) ()(((()()) ))))())))( ((((()()() (()(...
output:
impossible (()()) )(((( impossible (((() impossible )())())) impossible impossible ((((( (((() ()(()( (((()) impossible impossible ((((( ())())( ((((( impossible ())(() (((() ()((( impossible (((() impossible impossible impossible impossible impossible ()(()( impossible impossible impossible )))(()(...
result:
wrong answer the result string is incorrect (test case 2)