QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260083 | #7683. Hard Brackets Problem | jean# | TL | 27ms | 7384kb | C++14 | 842b | 2023-11-21 19:47:10 | 2023-11-21 19:47:10 |
Judging History
answer
#include"bits/stdc++.h"
using namespace std;
const int N = 1e6 + 10;
void solve() {
string s, s1, ans;
cin >> s;
int pos = 0, sum1 = 0, sum2 = 0;
for(int i = 0; i < s.size(); i++) {
if(s[i] == '(') sum1++;
else sum2++;
}
if(sum1 > sum2) {
cout << "impossible" << "\n";
return ;
}
while(s1.size() < s.size() && pos <= s1.size()) {
if(pos < s1.size() && s1[pos] == s[pos]) {
if(s[pos] == '(') s1.insert(pos, "()"), pos++, ans += "(";
else ans += ")", pos++;
}
else {
if(s[pos] == '(') s1.insert(pos, "()"), pos++, ans += "(";
else s1.insert(pos, ")"), ans += ")", pos++;
}
}
if(s1 == s) cout << ans << "\n";
else cout << "impossible" << "\n";
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int t;
cin >> t;
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
3 ((())) ( )))()
output:
((( impossible )))(
result:
ok 3 cases (3 test cases)
Test #2:
score: 0
Accepted
time: 19ms
memory: 3856kb
input:
100000 ())(()()() ()())())) )()()()() ())()(())( ((())())) )(())()))( )()))()))) )))))(((() ()))((()(( ()((()())) (()())()) ())(()))() (())(()))) ))))(()(() ()))(())(( ()((())()) ()))()))() ()((())()) ()()))((() ()))(())) (()(()))) ())((())) ())()((()) (()(()))) ()(((()()) ))))())))( ((((()()() (()(...
output:
impossible ()())())) )()()()( impossible ((())())) impossible )()))()))) impossible impossible ()((()( (()())()) ())(()))( (())(()))) impossible impossible ()((())( ()))()))( ()((())( impossible ()))(())) (()(()))) ())((( impossible (()(()))) impossible impossible impossible impossible impossible ()...
result:
ok 100000 cases (100000 test cases)
Test #3:
score: 0
Accepted
time: 19ms
memory: 3636kb
input:
200000 (())) ()))( )())) (()) )(((( )(()) )(()) ()))( ((()( ()(() ))()) )(((( ()()) (()) ()(() (()() )(()) ())) (()() ()()) (()) ()()( (()(( )()) (()() (()) ))((( (()) ())() ())() (())) ((((( )()) (())) ()(() )()() (())) ()()) (())) )(()) (())( ))))( ())(( ))((( ))))( ()() ()()) (()) (()) (()) )(())...
output:
(())) impossible )())) (( impossible )(( )(( impossible impossible impossible ))()) impossible ()()) (( impossible impossible )(( ())) impossible ()()) (( impossible impossible )()) impossible (( impossible (( ())( ())( (())) impossible )()) (())) impossible )()( (())) ()()) (())) )(( impossible imp...
result:
ok 200000 cases (200000 test cases)
Test #4:
score: 0
Accepted
time: 26ms
memory: 3876kb
input:
250000 ()() (()) ()) )((( (()( (()) )() (()) (()) ))() )(() )()) )()) (()) )()) ())) ()) (()( )))) ()(( ()() )()) ()) ()) ()) (()) ))() (()) (()( )))( ())) ()) )))( )(() ())) ()() (()) ((() (()) ))(( ))(( (()) ())) (()( (()) ((() )(() (()) (((( ()) ))() ()) ()() )()( )() (()) ))() ())) ()) )() )()) ...
output:
()( (( ()) impossible impossible (( )( (( (( ))( impossible )()) )()) (( )()) ())) ()) impossible )))) impossible ()( )()) ()) ()) ()) (( ))( (( impossible impossible ())) ()) impossible impossible ())) ()( (( impossible (( impossible impossible (( ())) impossible (( impossible impossible (( impossi...
result:
ok 250000 cases (250000 test cases)
Test #5:
score: 0
Accepted
time: 10ms
memory: 3632kb
input:
50000 )))()((((()(((())(() )(())()())((())))()( (((((()))()(((()((() )()(()())(()())(()() ()(())()()()((()))) )((())))((((())((((( ((())(()()))()(()()) ()))())(()))(()())(( ))(((())(())()))()) ((((()())()))()((((( ((())()))))(((())))) ()()(())((()(())))) ()())())))()()(())) ()))(())()())()(()) ()()(...
output:
impossible impossible impossible impossible ()(())()()()((()))) impossible ((())(()()))()(()( impossible ))(((())(())()))()) impossible ((())()))))(((())))) ()()(())((()(())))) ()())())))()()(())) ()))(())()())()(( impossible )))))(())()())((( impossible )(((()())()(())( impossible impossible imposs...
result:
ok 50000 cases (50000 test cases)
Test #6:
score: 0
Accepted
time: 19ms
memory: 3620kb
input:
83333 ((()((())(() (())(()())) ()(()(()))) ((((()))))) )())(((()))) ()()())()()) ()()((()))) (()(()(((()) ()((()()()() (()()()()))) (()()()(((() )))))()()()) )((()()()))) ))(((())))) ()())(()))() )()))))()()) )(()((())))( (()())(())) ())()((()))) (()()()(())) )())()()(()) ((())()))(() (()(()(((()) )...
output:
impossible (())(()())) ()(()(()))) ((((()))))) )())(((( ()()())()()) ()()((()))) impossible impossible (()()()()))) impossible )))))()()()) )((()()()))) ))(((())))) ()())(()))( )()))))()()) impossible (()())(())) ())()((()))) (()()()(( )())()()(( impossible impossible impossible impossible impossibl...
result:
ok 83333 cases (83333 test cases)
Test #7:
score: 0
Accepted
time: 26ms
memory: 3636kb
input:
250000 ))) )((( ()() ((() ((() ()) ())( ))(( )()) ()() ()() ()) ((() ()) ()() (()) (()) ()() ())) ()) )()) ()() )() ()) )()( (()) )() )((( ))() (()) )() )()) )() )() ))(( ()() (()) ()(( ))(( )((( ())) )()) )()) )()) )()) )((( ()) ))) (()) (()) ())( ()) (()) (()) ()() ())( ()() ()) ))() (()) (()) )()...
output:
))) impossible ()( impossible impossible ()) impossible impossible )()) ()( ()( ()) impossible ()) ()( (( (( ()( ())) ()) )()) ()( )( ()) impossible (( )( impossible ))( (( )( )()) )( )( impossible ()( (( impossible impossible impossible ())) )()) )()) )()) )()) impossible ()) ))) (( (( impossible (...
result:
ok 250000 cases (250000 test cases)
Test #8:
score: 0
Accepted
time: 21ms
memory: 3684kb
input:
50000 (())((()()(())(((()( ()()()((((()())()))) (())(()()()((())))() (())(()))(()(()())) ()((((()((()))))))) )))())))()()())()))( ()(()))(((())()((((( ()()())())(((()()))) (())(())))(()((()))) ()(()(())()()()()((( ()()()((()(()())))) )(())))()(())()())() )((((((()())())((()) )()())(()((()(())))) (()...
output:
impossible ()()()((((()())( (())(()()()((())))( (())(()))(()(()( ()((((()((()))))))) impossible impossible ()()())())(((()( (())(())))(()((( impossible ()()()((()(()())))) )(())))()(())()())( impossible )()())(()((()(( (())(()()())()())()) )())()()()()((())( (())()((())((())))) ))()))(()()))())))( )...
result:
ok 50000 cases (50000 test cases)
Test #9:
score: 0
Accepted
time: 19ms
memory: 3624kb
input:
83333 ((()(())))() ()))()()))() ()))()))())( ())(())))()) )()))))((((( )(()(()())(( (()))(())()) )()()()(()() ((()())((()) )())()()(()( ()(())()()) )(()(())()) ()(())(())) ))()(()(())( ()((()()))) )()(((()))) )())()()))) (((()()()))) ()())()())() ()())(())() )()((()())(( (()()((((()) (())))()())) ((...
output:
((()(())))( ()))()()))( impossible ())(())))()) impossible impossible (()))(())()) impossible impossible impossible ()(())()()) )(()(())( ()(())(())) impossible ()((()()))) )()(((( )())()()))) (((()()( ()())()())( ()())(())( impossible impossible (())))()())) ((((()))))) impossible ())()(()())) ()()...
result:
ok 83333 cases (83333 test cases)
Test #10:
score: 0
Accepted
time: 26ms
memory: 3560kb
input:
250000 )()) ())) ())( (()) ()() ()) ))(( ()) )() ()) ()(( ())) (()) )((( ()) (()) ))() )()) (()( )() (((( ())) )))( (()( ()() )))) )()) ()() ((() )((( ()() (()) )(() ()() )() )))( ()) ())( ()) )))( ))() ()) )()) ))(( ()) ())) ((() )()( )() ())) ()) )()) (()) (()( ()() ())) ())) )))( ())) )() ()) ())...
output:
)()) ())) impossible (( ()( ()) impossible ()) )( ()) impossible ())) (( impossible ()) (( ))( )()) impossible )( impossible ())) impossible impossible ()( )))) )()) ()( impossible impossible ()( (( impossible ()( )( impossible ()) impossible ()) impossible ))( ()) )()) impossible ()) ())) impossibl...
result:
ok 250000 cases (250000 test cases)
Test #11:
score: 0
Accepted
time: 17ms
memory: 3568kb
input:
50000 (())(()(()(())))()) ())()()))(())()()()) ())()())((()(())))) ()(()()))(()((()))) ()))))()))((()((())) ()(())())())(()))()) ((()((()((())))()))) ())()))()()()()))))) (((()()))))))()(()) ))(()((())((((()(((( ()((()()(((()()()()) (()())(()(()))()))) ()()))))(()(()()())) ())()())(((()(())))) ()(((...
output:
(())(()(()(())))()) ())()()))(())()()()) ())()())((()(())))) ()(()()))(()((( impossible ()(())())())(()))()) ((()((()((())))( ())()))()()()()))))) (((()()))))))()(( impossible impossible (()())(()(()))()))) ()()))))(()(()()( ())()())(((()(( ()((()(()))()(()))) impossible ()))())(())(((( ())(((()))()...
result:
ok 50000 cases (50000 test cases)
Test #12:
score: 0
Accepted
time: 19ms
memory: 3632kb
input:
83333 ())()))))(() (()((()(())) ((((((()())( ())(((((())) ((())((()))) )())())))))( ()(((())((() ()(((())))) (()))((())) )(())())(((( )()()()(()) )(()))(()))) )(((()()))) )(())(()())) (())))(()))( (((((()))))( ))((()()())( (((()))())() (((()()((()) ())))))((((( ()((((())))) )()(()))(()) (()))(()()))...
output:
impossible impossible impossible impossible ((())((( impossible impossible ()(((())))) (()))((( impossible )()()()(( )(()))(()))) )(((()( )(())(()())) impossible impossible impossible (((()))())( impossible impossible ()((((( )()(()))(( (()))(()())) )())))()())) impossible (())(()()( ()(()((( imposs...
result:
ok 83333 cases (83333 test cases)
Test #13:
score: 0
Accepted
time: 27ms
memory: 3668kb
input:
250000 (()) (((( (()) ()) ()() (()) (()) ()) ))() (()) ))() (()) ())) )))) (()) ())) ())) ()) )()( ))) )()) (()) (()) ))() (()) ()) ())) ))() ))(( )() ()() )((( (()) ()() )() )(() ()) )()) ((() ))() )((( ())) ()) ()) )()) ())) )()) (()) ))() )))) )()) ()) ))() )()( )))) (((( ()) (()) )() )()) ()) ()...
output:
(( impossible (( ()) ()( (( (( ()) ))( (( ))( (( ())) )))) (( ())) ())) ()) impossible ))) )()) (( (( ))( (( ()) ())) ))( impossible )( ()( impossible (( ()( )( impossible ()) )()) impossible ))( impossible ())) ()) ()) )()) ())) )()) (( ))( )))) )()) ()) ))( impossible )))) impossible ()) (( )( )()...
result:
ok 250000 cases (250000 test cases)
Test #14:
score: 0
Accepted
time: 17ms
memory: 3568kb
input:
50000 ))(())())())()(()(() )((())((()()))(()))) ()(()(()))()(()())) ((()())()())(()(())) )()()(())())()(())() (()(()(((())))()())) ((()))()()(()(()((() ()()()()(())(((()))) )))))((((()()()()((( ((())((()()(()))))) (((((()()()(())))))) ())())))())())()(()) ((())((((((()))))))) ((())()())())()()()) ()...
output:
impossible )((())((()()))(()))) ()(()(()))()(()())) ((()())()())(()(( )()()(())())()(())( (()(()(((())))()( impossible ()()()()(())(((( impossible ((())((()()(()))))) (((((()()()(( ())())))())())()(( ((())((((((( ((())()())())()()()) ()((((()(((( ()())(((()))((())))) impossible ))))))(())()(((( ()()...
result:
ok 50000 cases (50000 test cases)
Test #15:
score: 0
Accepted
time: 15ms
memory: 3564kb
input:
83333 )))((())(()( ()((()))()) (()))()(()(( ))((()()(()( (()))()())) )))()()(()(( )(()))()()(( ())((())))) (())))()()) )(()()))(()( ()(()()))() ()))())())(( ((()(()()))) (((())()()() ()(())(()()) ))())((())) ())((()()(() ))(()((()))) ((((()())))) (()((())())( )()())(())() ))(()())())) (()(())(()() (...
output:
impossible ()((()))()) impossible impossible (()))()())) impossible impossible ())((())))) (())))()()) impossible ()(()()))( impossible ((()(()( impossible ()(())(()( ))())((( impossible ))(()((( ((((()( impossible )()())(())( ))(()())())) impossible ())(())()( impossible impossible ))()(())()) ()((...
result:
ok 83333 cases (83333 test cases)
Test #16:
score: 0
Accepted
time: 8ms
memory: 7340kb
input:
1 (()()((((())))(((((((())(()())())()(()((()(((()(()))))())((())((())((()))()())(()))()))((())()())))()())()(()((())(((()()(((())(((()))(((()())((()(((()())()())(()(()(())()()())())(((((((()((((()))()())())((((()(()())()())))((()((((()(((((()((((())()(()(()((((()()(((())())())))(())))))))))((((()(()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #17:
score: 0
Accepted
time: 9ms
memory: 5648kb
input:
2 ())())()()(((()))()(((()())(())))))((()((()()()()()())(()((((()))()()((())()()((()))()())(())))(()(())(()()())(())))()())((((()()(()))((())()(())))))(((()(((((()(())()()((())))))(()(()())))))((())))))())())()()(()(()()))(((()))(()())))(())()))()())()()())()((()((()())())))())())((()((()())())(((()...
output:
())())()()(((()))()(((()())(())))))((()((()()()()()())(()((((()))()()((())()()((()))()())(())))(()(())(()()())(())))()())((((()()(()))((())()(())))))(((()(((((()(())()()((())))))(()(()())))))((())))))())())()()(()(()()))(((()))(()())))(())()))()())()()())()((()((()())())))())())((()((()())())(((()))...
result:
ok 2 cases (2 test cases)
Test #18:
score: 0
Accepted
time: 14ms
memory: 7140kb
input:
1 ()(()(()))()()()((()())(())())())()(())(()()(()))(())()()()((()(()(())(()()(()((((()()))))))())((()))))((())((((()))(((((()(()))(((())((()))()()((()(()((()((()()()))(())))(())())()()))))((((()(())))))((()(()((()()())())())(()())(()()))()((((()))())()(((()(())))()()((((()))))()))()()))))((())((()((...
output:
()(()(()))()()()((()())(())())())()(())(()()(()))(())()()()((()(()(())(()()(()((((()()))))))())((()))))((())((((()))(((((()(()))(((())((()))()()((()(()((()((()()()))(())))(())())()()))))((((()(())))))((()(()((()()())())())(()())(()()))()((((()))())()(((()(())))()()((((()))))()))()()))))((())((()(()(...
result:
ok 1 cases (1 test case)
Test #19:
score: 0
Accepted
time: 13ms
memory: 7228kb
input:
1 ()((()(((()))(())()())((()((()))((()()((()())(())())())(()()()()())(())(()((()(((())()((()((((((((())(()))))(((()()(()))(((()()())(()()(())))((((())()(()((()(())))()((())((((())())(()()()(()())((())(((()(((()))((()((()(()))))))())((())))((()))(((())))))))())(((((()(((())))(()())()()(())()(())(()()...
output:
()((()(((()))(())()())((()((()))((()()((()())(())())())(()()()()())(())(()((()(((())()((()((((((((())(()))))(((()()(()))(((()()())(()()(())))((((())()(()((()(())))()((())((((())())(()()()(()())((())(((()(((()))((()((()(()))))))())((())))((()))(((())))))))())(((((()(((())))(()())()()(())()(())(()())(...
result:
ok 1 cases (1 test case)
Test #20:
score: 0
Accepted
time: 18ms
memory: 7384kb
input:
1 )()((((())()))(())()))()(()))()())()(((()()(()(())))(()(((()))(((()()()))())))(())())()))(()((()))())()()()((((()))())))())((()())(()())))(((()(())()((()())(()((((())))(())))(()(())())(())(()()))(()((((()(())((())()()(((())()))(((()))(()(())(()()()()()()(())(((()()()(()(()(()))(()()))(((()((()()((...
output:
)()((((())()))(())()))()(()))()())()(((()()(()(())))(()(((()))(((()()()))())))(())())()))(()((()))())()()()((((()))())))())((()())(()())))(((()(())()((()())(()((((())))(())))(()(())())(())(()()))(()((((()(())((())()()(((())()))(((()))(()(())(()()()()()()(())(((()()()(()(()(()))(()()))(((()((()()(())...
result:
ok 1 cases (1 test case)
Test #21:
score: 0
Accepted
time: 8ms
memory: 7244kb
input:
1 ())((()())()(((((()(((())()))((((()()))))))()())())(()())(())))())()((((()((()))))(()))))(((()(())((()()(()()(()))))()())))()))()(((())(()))))()()()(((((((())))(((()()))(())(()()))()))())))(((()((()())()()(((()()(((((((((())(()(())))(())()((()))))()((((())()(((()))))(()(())())(((()()(((((()(((()((...
output:
())((()())()(((((()(((())()))((((()()))))))()())())(()())(())))())()((((()((()))))(()))))(((()(())((()()(()()(()))))()())))()))()(((())(()))))()()()(((((((())))(((()()))(())(()()))()))())))(((()((()())()()(((()()(((((((((())(()(())))(())()((()))))()((((())()(((()))))(()(())())(((()()(((((()(((()(())...
result:
ok 1 cases (1 test case)
Test #22:
score: 0
Accepted
time: 18ms
memory: 7216kb
input:
1 (()))())(())((()(()())())))())(()((((())))())())(()((()(()(()((((()))()())()))(((()())()))((())))))))()())()))((()))()()()))())))()(())())(()(()()()(()((()))))((())))((((())()((())))())())()))()()))))()())(()))()(())(((()))))()))(()(()((()(()(((((()(())))(())(()))()()())))))()()))(((()())(())))(()...
output:
(()))())(())((()(()())())))())(()((((())))())())(()((()(()(()((((()))()())()))(((()())()))((())))))))()())()))((()))()()()))())))()(())())(()(()()()(()((()))))((())))((((())()((())))())())()))()()))))()())(()))()(())(((()))))()))(()(()((()(()(((((()(())))(())(()))()()())))))()()))(((()())(())))(()))...
result:
ok 1 cases (1 test case)
Test #23:
score: 0
Accepted
time: 14ms
memory: 7136kb
input:
1 ()((()(()(()))())(())(()())((()))()()))(())(()))()((((()(()))))((())))())())()((()(()(()())(())())))(((((()(()(((()))()()))(()()((()))))((())()))))(()())(((())))))(((())((()))((((())()))))()()()))()()()()(())()((()))(()()(()()((())(((()(()()()))))())((((())(((()(((((()()()()))))()))))()((()))))))(...
output:
()((()(()(()))())(())(()())((()))()()))(())(()))()((((()(()))))((())))())())()((()(()(()())(())())))(((((()(()(((()))()()))(()()((()))))((())()))))(()())(((())))))(((())((()))((((())()))))()()()))()()()()(())()((()))(()()(()()((())(((()(()()()))))())((((())(((()(((((()()()()))))()))))()((()))))))(()...
result:
ok 1 cases (1 test case)
Test #24:
score: 0
Accepted
time: 17ms
memory: 7144kb
input:
1 (((()((())((((()(((((()())())))())(((())()(()(()())()((())())))()(()(()())())()()())((()))()())))()(((())()))(())(()((()))))()()(())((()((()(()))))())))))(()(((((((()())))((((())))))(((())())(()))(()(()))((((((()((()()()(()())())())(()(()())))())(((()()()((())))(()()()()()((())())))(())))()()(())(...
output:
(((()((())((((()(((((()())())))())(((())()(()(()())()((())())))()(()(()())())()()())((()))()())))()(((())()))(())(()((()))))()()(())((()((()(()))))())))))(()(((((((()())))((((())))))(((())())(()))(()(()))((((((()((()()()(()())())())(()(()())))())(((()()()((())))(()()()()()((())())))(())))()()(())())...
result:
ok 1 cases (1 test case)
Test #25:
score: 0
Accepted
time: 17ms
memory: 7224kb
input:
1 )))()())(()()()))(((((((((())(()(())()()()))(((()))()))()((())(()(())))())))(((()(())(()))(()(()(()))(())))((()))(()()())()((((())((())))()())))))(()())())))()()(((())()))())(()))((((())((((((())(()((((((()(()(()((()(((())()(()))()(()(((()))()(()(()()((((((()()))())())()))()(()(())))(()()))()(((((...
output:
)))()())(()()()))(((((((((())(()(())()()()))(((()))()))()((())(()(())))())))(((()(())(()))(()(()(()))(())))((()))(()()())()((((())((())))()())))))(()())())))()()(((())()))())(()))((((())((((((())(()((((((()(()(()((()(((())()(()))()(()(((()))()(()(()()((((((()()))())())()))()(()(())))(()()))()((((()(...
result:
ok 1 cases (1 test case)
Test #26:
score: 0
Accepted
time: 0ms
memory: 4328kb
input:
1 )((((())()(()))(())))))())())()(()))(((()))(()())))(((()((((()(()))))(((()))((((()((()(())))))())()(((((()()))(()((()(()((()()()(())))()))(((()()))()()((((()()(((()(()))())(((()())(()(())((()(()((())()))())())(((((((()))()))())(((()(())))()())(())()())(()))((((())(())))((())((())(((())))()()(()())...
output:
impossible
result:
ok 1 cases (1 test case)
Test #27:
score: 0
Accepted
time: 0ms
memory: 4196kb
input:
1 ((())(())(())))((())))()()()((())))((((()()(((()()))))()()()()(((())((()((()))(((((())(())(()())))))))((((()))))())()))((()(((((())))))(()())())))(()(()))(((()((())((()()())(()()((()()()))((((((((()))))(()(()))()((()()())(((())(((())())()))()(((()((((()((())()(()((()(()((((())))(((()))())((((())()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #28:
score: 0
Accepted
time: 2ms
memory: 4212kb
input:
1 )()()((())))))()()())))(()))()(()(())()))))())()(()(()()(((())()))))(())((())()))))))((()()()))()(()(()))))()()()(()()))))())())))))))(((()(())()()))))((()()(((((()(((())())(()(())(())))(()))()()))())((((((((((())(()(()))(()()()()(())(())(()(((()(()))()((()(()))((((())(()()()((()(())))((())((())((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #29:
score: 0
Accepted
time: 12ms
memory: 7136kb
input:
1 (()))(()(()())())(((())()())((())))(())))))))((())()))))())()()))()()))))))())())((()))))))()()()))()())(())))()()(((())())(((())))(()()()(((()((()())))(()))())))))()))(())(())(()))(()()())))()))(((()))(()())))()(((()(((()()))(())()()))()(()()())()()(((((()()()))())))()((())()))(()((()()()()((((((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #30:
score: 0
Accepted
time: 17ms
memory: 7224kb
input:
1 (((()))(()((())()(())()()())()(())()()()()))()(()()))(())(())(())((())(((())(()()))())()))(()((((((())()))(((()))))))()(((()()(())))()()(())))()))()(()())()((()((((()()())()((((((())((((((((())(()()()(()))(((()(()(((((())((()))(((((()(()(((()()(()(())()()((((())))(()))(())())))(())))((((()))()))()...
output:
(((()))(()((())()(())()()())()(())()()()()))()(()()))(())(())(())((())(((())(()()))())()))(()((((((())()))(((()))))))()(((()()(())))()()(())))()))()(()())()((()((((()()())()((((((())((((((((())(()()()(()))(((()(()(((((())((()))(((((()(()(((()()(()(())()()((((())))(()))(())())))(())))((((()))()))()((...
result:
ok 1 cases (1 test case)
Test #31:
score: 0
Accepted
time: 17ms
memory: 7300kb
input:
1 ))()))((())()((()))(()))(())())(()()(())()((((())())()()()()()))))(((()(()(((()(((()(((()())((())(()(())))(()()))((()()((()))()))(()))()))((())())))())(())))()((()())()()((((()()())())))((())()((((()()()())((((((((())))))()()()(()())(())()(()((()()(()())(()(()(())((())((())()(()))())(((()(())(((((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #32:
score: 0
Accepted
time: 12ms
memory: 7216kb
input:
1 )))()()()()((())())))))))))))()(()))()()())((((((()))((())))((())(((())(()())()))))()()))()))((()((()(())(())(())())(((((()())))))(((()(()())()((())))))()(((()((()(((()()((())))))((()(()((())()))()))()(((())))))())(())((((((((()()())()))))(()(()((()()())(())))))())((((()()(())(((())))((()())())(()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #33:
score: 0
Accepted
time: 13ms
memory: 7216kb
input:
1 ((((())))))(()()((((()(())()))))(((()()())()())))(())(())())()(()))(()()()(((()((()))))))(()())))(()((((((((()(((())(()))())))(()())))()(((()))))()()(((()()()((()(()()()((()()((()))()())))()((())()()))()(((((()))((()((())(((()((()()(()))(()))())()()(())((((())())()))()()()())))()(()())))(()()))(((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #34:
score: 0
Accepted
time: 12ms
memory: 7188kb
input:
1 )(()))))))))()(())(((((())))()))())))())))()()(((()((())(()))(())(()())()())(()((())((((())())))())(((()()()()))())())()()((()(((()(()(((())(()((()()()()((()()()())))((()()()(((())))))))))))())()())))((()()())))))(((()()())()))(()))()))())))))))))()(()(()((())))()(()())(()))()()))())((()(()()()(((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #35:
score: 0
Accepted
time: 10ms
memory: 7136kb
input:
1 ))(((()(()((()(((()((())()((((()()))((()(((()(())(((())))((()))))()(())))(((((()())))(())())(()())()(((((()(())()))(((((()(())())))())))(((((()())())()(()())))))())(()))(((((((()((((((((((())))((())(())((()))))()((((())()(())((((()((((()))))))(())(())(()))))()()(())))()((()))(())())())(())())))))(...
output:
impossible
result:
ok 1 cases (1 test case)
Test #36:
score: 0
Accepted
time: 17ms
memory: 7204kb
input:
1 (()()))()(())())()(()))(())()())(()((())))())(()))())()(((()))()()()())()(((()(()(((()))()))((())(()()(((())(())()))()()))((()()))((()((((((((()()(())()(((()))(()()(((()))(((((()()))((((()((()((())((()))))))(((((()(()()())()))))))(()())(((((()()((()))(())(((()((()()(())()()())))())()((()()((((()()...
output:
(()()))()(())())()(()))(())()())(()((())))())(()))())()(((()))()()()())()(((()(()(((()))()))((())(()()(((())(())()))()()))((()()))((()((((((((()()(())()(((()))(()()(((()))(((((()()))((((()((()((())((()))))))(((((()(()()())()))))))(()())(((((()()((()))(())(((()((()()(())()()())))())()((()()((((()()))...
result:
ok 1 cases (1 test case)
Test #37:
score: 0
Accepted
time: 16ms
memory: 7300kb
input:
1 ()))))((((()()()()((())((())((()()((()(((((()()()(((())())))())())()(()))((())((((((())((())()())())()())()()((((()(((())()()))(((()))((((()(()))))(()()()()((())))))(())()(((()))))())())())((()()))())())()((()()()(()()()()(((()()))())(()())(()()(())))(()))))())())(((()))(((())))()()(())))()(((()))...
output:
impossible
result:
ok 1 cases (1 test case)
Test #38:
score: 0
Accepted
time: 12ms
memory: 7316kb
input:
1 )()())())((()((()(())(())(())())(((((()())))))(((()(()())()((())))))()(((()((()(((()()((())))))((()(()((())()))()))()(((())))))())(())((((((((()()())()))))(()(()((()()())(())))))())((((()()(())(((())))((()())())(()(()(()((())()((((())()()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(...
output:
)()())())((()((()(())(())(())())(((((()())))))(((()(()())()((())))))()(((()((()(((()()((())))))((()(()((())()))()))()(((())))))())(())((((((((()()())()))))(()(()((()()())(())))))())((((()()(())(((())))((()())())(()(()(()((())()((((())()()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(()...
result:
ok 1 cases (1 test case)
Test #39:
score: 0
Accepted
time: 18ms
memory: 7216kb
input:
1 (())(((()))))((()()()(()(((((((()()(()((())())(())))))())()((())(())()))(()(()()()(()))(()(())()()(()())))))()())))((()((())()()())())())()))())())()()(())((()))()()(()))))()(())(()()()()()()())()(((()((())())(())))())()(()(())())()()(()()(((())(()(((((())()))(()()())()()())(()(())(()())))()())))(...
output:
(())(((()))))((()()()(()(((((((()()(()((())())(())))))())()((())(())()))(()(()()()(()))(()(())()()(()())))))()())))((()((())()()())())())()))())())()()(())((()))()()(()))))()(())(()()()()()()())()(((()((())())(())))())()(()(())())()()(()()(((())(()(((((())()))(()()())()()())(()(())(()())))()())))(()...
result:
ok 1 cases (1 test case)
Test #40:
score: 0
Accepted
time: 13ms
memory: 7136kb
input:
1 )))))(()((((()))())))()()((())(()()())(()())()))))()(((())))((()()))(((()()(((((()()(()())()(())(((()))))()(()))(())))(()())((()(())())))(()(()(((()((()))(((((())(())(()(()(()())))())(()))()((((()))()())))()())(()()((()()(()()))))))(())(()()(())(())())()()(()))()))))()()()((()(())()))()((())))())(...
output:
)))))(()((((()))())))()()((())(()()())(()())()))))()(((())))((()()))(((()()(((((()()(()())()(())(((()))))()(()))(())))(()())((()(())())))(()(()(((()((()))(((((())(())(()(()(()())))())(()))()((((()))()())))()())(()()((()()(()()))))))(())(()()(())(())())()()(()))()))))()()()((()(())()))()((())))())()(...
result:
ok 1 cases (1 test case)
Test #41:
score: 0
Accepted
time: 14ms
memory: 7152kb
input:
1 )))(()()(())))())()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()()))))))((())()))()(((()))()))(())))(()(((()((((((((()))((())))())())())))()((())))()(((()))()((()())())((()())()))()(()())()())...
output:
)))(()()(())))())()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()()))))))((())()))()(((()))()))(())))(()(((()((((((((()))((())))())())())))()((())))()(((()))()((()())())((()())()))()(()())()()))(...
result:
ok 1 cases (1 test case)
Test #42:
score: 0
Accepted
time: 14ms
memory: 7360kb
input:
1 )))())(())()())))()()()((()))(()))()(((()()()(()))(()()())())(((()(())))()))()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()())))))))((())()))()(((()))())(())))(()(((()((((((((()))((())))())())...
output:
)))())(())()())))()()()((()))(()))()(((()()()(()))(()()())())(((()(())))()))()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()())))))))((())()))()(((()))())(())))(()(((()((((((((()))((())))())())()...
result:
ok 1 cases (1 test case)
Test #43:
score: 0
Accepted
time: 14ms
memory: 7224kb
input:
1 )((()()))()()(()))())())()((())(()(())(())(()))))()((()()(()())))()(()((()))())()))()()(())(())((((()((()()()))))))()())()()()()()())(()())()((((()((()(())))()())())())))()())()()())(()((())))()(()())(((((((())))(((())((()())()((()))(()())(()((()()())(())(()((())))((()()()())(()))()))()))))(((((((...
output:
)((()()))()()(()))())())()((())(()(())(())(()))))()((()()(()())))()(()((()))())()))()()(())(())((((()((()()()))))))()())()()()()()())(()())()((((()((()(())))()())())())))()())()()())(()((())))()(()())(((((((())))(((())((()())()((()))(()())(()((()()())(())(()((())))((()()()())(()))()))()))))((((((()(...
result:
ok 1 cases (1 test case)
Test #44:
score: 0
Accepted
time: 17ms
memory: 7316kb
input:
1 )))()(((()()(()))(((())())()()(()()(())))))))(()))((()()))(()))()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(()))()))))()()())(()()))(()((((()))))))())()(()(((()())(()(((()))(()))())))(((((())((((()())((()(((())(()(()))()()())()())))()()(((())())))))))))(((()()()()()()()()(()()))((...
output:
)))()(((()()(()))(((())())()()(()()(())))))))(()))((()()))(()))()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(()))()))))()()())(()()))(()((((()))))))())()(()(((()())(()(((()))(()))())))(((((())((((()())((()(((())(()(()))()()())()())))()()(((())())))))))))(((()()()()()()()()(()()))(())...
result:
ok 1 cases (1 test case)
Test #45:
score: 0
Accepted
time: 17ms
memory: 7212kb
input:
1 )))())()))))()))(()))()))()((())(())))(()((((()())(((()()(()))()))()))((()((())))(((()()))()))(()))))(()(((((((()))())(()((((())()))(()((())(((()(((()(((()))))(())((()(()()))(()))(((())(()()))((()())((((((()(()())())))))((()))())((((((()(())(()()(()()(()()((((((((())())())(()(()())((((())))())))()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #46:
score: 0
Accepted
time: 17ms
memory: 7244kb
input:
1 (((())))(((()()()()(()))()())()))(()((()()()()())()())))((()())(((()()())(()))(()))()()((()()(())()(())))())(())(()(()()(((()()(())((((()((()))()())()((())(())(()((((())((((())(((((())()((()(())))(()()(()()()))()((((()((())((())())))((()((()(((()())))))((()())((((())()()())((((()())))())()((()))((...
output:
(((())))(((()()()()(()))()())()))(()((()()()()())()())))((()())(((()()())(()))(()))()()((()()(())()(())))())(())(()(()()(((()()(())((((()((()))()())()((())(())(()((((())((((())(((((())()((()(())))(()()(()()()))()((((()((())((())())))((()((()(((()())))))((()())((((())()()())((((()())))())()((()))(()(...
result:
ok 1 cases (1 test case)
Test #47:
score: 0
Accepted
time: 17ms
memory: 7212kb
input:
1 ))((((()))())))(((())()()((()))(((()((())())()((())((((((((()))()()(((())(()((((())()))(()(((())()((())(())(()))(()))()(()()())(())))((())(()()))())))))(()))()(((()())))(()))()())))()()((()(((()))))((()((((())(())(())()())))(()())(((()()(()(())()()()))))()())())))(()((()(()(()())))()))(())))))))((...
output:
))((((()))())))(((())()()((()))(((()((())())()((())((((((((()))()()(((())(()((((())()))(()(((())()((())(())(()))(()))()(()()())(())))((())(()()))())))))(()))()(((()())))(()))()())))()()((()(((()))))((()((((())(())(())()())))(()())(((()()(()(())()()()))))()())())))(()((()(()(()())))()))(())))))))((()...
result:
ok 1 cases (1 test case)
Test #48:
score: 0
Accepted
time: 14ms
memory: 7244kb
input:
1 )))()()(()))()))(()(())())(()())((((())()))(())()(()))))((((((())))((()(())()((((()())(()())())()()(()(())(()(((()))))(()()((())((((((()))(((((()()))()())()))))((())()())((((()))))())())())()))()()()))())))(((()))((()()((((())))((()()()(())((()()()())()())()()()()(((())(()))())(()))()(()(()())())(...
output:
)))()()(()))()))(()(())())(()())((((())()))(())()(()))))((((((())))((()(())()((((()())(()())())()()(()(())(()(((()))))(()()((())((((((()))(((((()()))()())()))))((())()())((((()))))())())())()))()()()))())))(((()))((()()((((())))((()()()(())((()()()())()())()()()()(((())(()))())(()))()(()(()())())(((...
result:
ok 1 cases (1 test case)
Test #49:
score: -100
Time Limit Exceeded
input:
1 ()(((((((((((((((((((((((((((()((((((((((((((((((((((((((((((((((((((((((()())(()((((((((((()((((((((((((((((((()(()()()((((((((((((()(()((()((((((((((()(((((((((((((((())((((((((((((((((((((((((((((((((((((((((((((((())((((((((((()((((((()(((((((((((((((((((((((((()(()(()(((((((((((()((((((((((((...