QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260068 | #7683. Hard Brackets Problem | jean# | TL | 30ms | 7200kb | C++14 | 651b | 2023-11-21 19:35:37 | 2023-11-21 19:35:42 |
Judging History
answer
#include"bits/stdc++.h"
using namespace std;
const int N = 1e6 + 10;
void solve() {
string s, s1, ans;
cin >> s;
int len = s.size();
int pos = 0;
while(s1.size() < s.size()) {
if(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: 1ms
memory: 3396kb
input:
3 ((())) ( )))()
output:
((( impossible )))(
result:
ok 3 cases (3 test cases)
Test #2:
score: 0
Accepted
time: 21ms
memory: 3436kb
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: 29ms
memory: 3432kb
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: 3480kb
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: 21ms
memory: 3428kb
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: 20ms
memory: 3436kb
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: 3400kb
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: 3432kb
input:
50000 (())((()()(())(((()( ()()()((((()())()))) (())(()()()((())))() (())(()))(()(()())) ()((((()((()))))))) )))())))()()())()))( ()(()))(((())()((((( ()()())())(((()()))) (())(())))(()((()))) ()(()(())()()()()((( ()()()((()(()())))) )(())))()(())()())() )((((((()())())((()) )()())(()((()(())))) (()...
output:
impossible ()()()((((()())( (())(()()()((())))( (())(()))(()(()( ()((((()((()))))))) impossible impossible ()()())())(((()( (())(())))(()((( impossible ()()()((()(()())))) )(())))()(())()())( impossible )()())(()((()(( (())(()()())()())()) )())()()()()((())( (())()((())((())))) ))()))(()()))())))( )...
result:
ok 50000 cases (50000 test cases)
Test #9:
score: 0
Accepted
time: 20ms
memory: 3484kb
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: 30ms
memory: 3464kb
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: 14ms
memory: 3380kb
input:
50000 (())(()(()(())))()) ())()()))(())()()()) ())()())((()(())))) ()(()()))(()((()))) ()))))()))((()((())) ()(())())())(()))()) ((()((()((())))()))) ())()))()()()()))))) (((()()))))))()(()) ))(()((())((((()(((( ()((()()(((()()()()) (()())(()(()))()))) ()()))))(()(()()())) ())()())(((()(())))) ()(((...
output:
(())(()(()(())))()) ())()()))(())()()()) ())()())((()(())))) ()(()()))(()((( impossible ()(())())())(()))()) ((()((()((())))( ())()))()()()()))))) (((()()))))))()(( impossible impossible (()())(()(()))()))) ()()))))(()(()()( ())()())(((()(( ()((()(()))()(()))) impossible ()))())(())(((( ())(((()))()...
result:
ok 50000 cases (50000 test cases)
Test #12:
score: 0
Accepted
time: 20ms
memory: 3492kb
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: 30ms
memory: 3388kb
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: 21ms
memory: 3372kb
input:
50000 ))(())())())()(()(() )((())((()()))(()))) ()(()(()))()(()())) ((()())()())(()(())) )()()(())())()(())() (()(()(((())))()())) ((()))()()(()(()((() ()()()()(())(((()))) )))))((((()()()()((( ((())((()()(()))))) (((((()()()(())))))) ())())))())())()(()) ((())((((((()))))))) ((())()())())()()()) ()...
output:
impossible )((())((()()))(()))) ()(()(()))()(()())) ((()())()())(()(( )()()(())())()(())( (()(()(((())))()( impossible ()()()()(())(((( impossible ((())((()()(()))))) (((((()()()(( ())())))())())()(( ((())((((((( ((())()())())()()()) ()((((()(((( ()())(((()))((())))) impossible ))))))(())()(((( ()()...
result:
ok 50000 cases (50000 test cases)
Test #15:
score: 0
Accepted
time: 20ms
memory: 3432kb
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: 18ms
memory: 7148kb
input:
1 (()()((((())))(((((((())(()())())()(()((()(((()(()))))())((())((())((()))()())(()))()))((())()())))()())()(()((())(((()()(((())(((()))(((()())((()(((()())()())(()(()(())()()())())(((((((()((((()))()())())((((()(()())()())))((()((((()(((((()((((())()(()(()((((()()(((())())())))(())))))))))((((()(()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #17:
score: 0
Accepted
time: 13ms
memory: 6144kb
input:
2 ())())()()(((()))()(((()())(())))))((()((()()()()()())(()((((()))()()((())()()((()))()())(())))(()(())(()()())(())))()())((((()()(()))((())()(())))))(((()(((((()(())()()((())))))(()(()())))))((())))))())())()()(()(()()))(((()))(()())))(())()))()())()()())()((()((()())())))())())((()((()())())(((()...
output:
())())()()(((()))()(((()())(())))))((()((()()()()()())(()((((()))()()((())()()((()))()())(())))(()(())(()()())(())))()())((((()()(()))((())()(())))))(((()(((((()(())()()((())))))(()(()())))))((())))))())())()()(()(()()))(((()))(()())))(())()))()())()()())()((()((()())())))())())((()((()())())(((()))...
result:
ok 2 cases (2 test cases)
Test #18:
score: 0
Accepted
time: 18ms
memory: 7152kb
input:
1 ()(()(()))()()()((()())(())())())()(())(()()(()))(())()()()((()(()(())(()()(()((((()()))))))())((()))))((())((((()))(((((()(()))(((())((()))()()((()(()((()((()()()))(())))(())())()()))))((((()(())))))((()(()((()()())())())(()())(()()))()((((()))())()(((()(())))()()((((()))))()))()()))))((())((()((...
output:
()(()(()))()()()((()())(())())())()(())(()()(()))(())()()()((()(()(())(()()(()((((()()))))))())((()))))((())((((()))(((((()(()))(((())((()))()()((()(()((()((()()()))(())))(())())()()))))((((()(())))))((()(()((()()())())())(()())(()()))()((((()))())()(((()(())))()()((((()))))()))()()))))((())((()(()(...
result:
ok 1 cases (1 test case)
Test #19:
score: 0
Accepted
time: 18ms
memory: 7196kb
input:
1 ()((()(((()))(())()())((()((()))((()()((()())(())())())(()()()()())(())(()((()(((())()((()((((((((())(()))))(((()()(()))(((()()())(()()(())))((((())()(()((()(())))()((())((((())())(()()()(()())((())(((()(((()))((()((()(()))))))())((())))((()))(((())))))))())(((((()(((())))(()())()()(())()(())(()()...
output:
()((()(((()))(())()())((()((()))((()()((()())(())())())(()()()()())(())(()((()(((())()((()((((((((())(()))))(((()()(()))(((()()())(()()(())))((((())()(()((()(())))()((())((((())())(()()()(()())((())(((()(((()))((()((()(()))))))())((())))((()))(((())))))))())(((((()(((())))(()())()()(())()(())(()())(...
result:
ok 1 cases (1 test case)
Test #20:
score: 0
Accepted
time: 19ms
memory: 7056kb
input:
1 )()((((())()))(())()))()(()))()())()(((()()(()(())))(()(((()))(((()()()))())))(())())()))(()((()))())()()()((((()))())))())((()())(()())))(((()(())()((()())(()((((())))(())))(()(())())(())(()()))(()((((()(())((())()()(((())()))(((()))(()(())(()()()()()()(())(((()()()(()(()(()))(()()))(((()((()()((...
output:
)()((((())()))(())()))()(()))()())()(((()()(()(())))(()(((()))(((()()()))())))(())())()))(()((()))())()()()((((()))())))())((()())(()())))(((()(())()((()())(()((((())))(())))(()(())())(())(()()))(()((((()(())((())()()(((())()))(((()))(()(())(()()()()()()(())(((()()()(()(()(()))(()()))(((()((()()(())...
result:
ok 1 cases (1 test case)
Test #21:
score: 0
Accepted
time: 14ms
memory: 7148kb
input:
1 ())((()())()(((((()(((())()))((((()()))))))()())())(()())(())))())()((((()((()))))(()))))(((()(())((()()(()()(()))))()())))()))()(((())(()))))()()()(((((((())))(((()()))(())(()()))()))())))(((()((()())()()(((()()(((((((((())(()(())))(())()((()))))()((((())()(((()))))(()(())())(((()()(((((()(((()((...
output:
())((()())()(((((()(((())()))((((()()))))))()())())(()())(())))())()((((()((()))))(()))))(((()(())((()()(()()(()))))()())))()))()(((())(()))))()()()(((((((())))(((()()))(())(()()))()))())))(((()((()())()()(((()()(((((((((())(()(())))(())()((()))))()((((())()(((()))))(()(())())(((()()(((((()(((()(())...
result:
ok 1 cases (1 test case)
Test #22:
score: 0
Accepted
time: 18ms
memory: 7108kb
input:
1 (()))())(())((()(()())())))())(()((((())))())())(()((()(()(()((((()))()())()))(((()())()))((())))))))()())()))((()))()()()))())))()(())())(()(()()()(()((()))))((())))((((())()((())))())())()))()()))))()())(()))()(())(((()))))()))(()(()((()(()(((((()(())))(())(()))()()())))))()()))(((()())(())))(()...
output:
(()))())(())((()(()())())))())(()((((())))())())(()((()(()(()((((()))()())()))(((()())()))((())))))))()())()))((()))()()()))())))()(())())(()(()()()(()((()))))((())))((((())()((())))())())()))()()))))()())(()))()(())(((()))))()))(()(()((()(()(((((()(())))(())(()))()()())))))()()))(((()())(())))(()))...
result:
ok 1 cases (1 test case)
Test #23:
score: 0
Accepted
time: 11ms
memory: 7056kb
input:
1 ()((()(()(()))())(())(()())((()))()()))(())(()))()((((()(()))))((())))())())()((()(()(()())(())())))(((((()(()(((()))()()))(()()((()))))((())()))))(()())(((())))))(((())((()))((((())()))))()()()))()()()()(())()((()))(()()(()()((())(((()(()()()))))())((((())(((()(((((()()()()))))()))))()((()))))))(...
output:
()((()(()(()))())(())(()())((()))()()))(())(()))()((((()(()))))((())))())())()((()(()(()())(())())))(((((()(()(((()))()()))(()()((()))))((())()))))(()())(((())))))(((())((()))((((())()))))()()()))()()()()(())()((()))(()()(()()((())(((()(()()()))))())((((())(((()(((((()()()()))))()))))()((()))))))(()...
result:
ok 1 cases (1 test case)
Test #24:
score: 0
Accepted
time: 15ms
memory: 7152kb
input:
1 (((()((())((((()(((((()())())))())(((())()(()(()())()((())())))()(()(()())())()()())((()))()())))()(((())()))(())(()((()))))()()(())((()((()(()))))())))))(()(((((((()())))((((())))))(((())())(()))(()(()))((((((()((()()()(()())())())(()(()())))())(((()()()((())))(()()()()()((())())))(())))()()(())(...
output:
(((()((())((((()(((((()())())))())(((())()(()(()())()((())())))()(()(()())())()()())((()))()())))()(((())()))(())(()((()))))()()(())((()((()(()))))())))))(()(((((((()())))((((())))))(((())())(()))(()(()))((((((()((()()()(()())())())(()(()())))())(((()()()((())))(()()()()()((())())))(())))()()(())())...
result:
ok 1 cases (1 test case)
Test #25:
score: 0
Accepted
time: 11ms
memory: 7128kb
input:
1 )))()())(()()()))(((((((((())(()(())()()()))(((()))()))()((())(()(())))())))(((()(())(()))(()(()(()))(())))((()))(()()())()((((())((())))()())))))(()())())))()()(((())()))())(()))((((())((((((())(()((((((()(()(()((()(((())()(()))()(()(((()))()(()(()()((((((()()))())())()))()(()(())))(()()))()(((((...
output:
)))()())(()()()))(((((((((())(()(())()()()))(((()))()))()((())(()(())))())))(((()(())(()))(()(()(()))(())))((()))(()()())()((((())((())))()())))))(()())())))()()(((())()))())(()))((((())((((((())(()((((((()(()(()((()(((())()(()))()(()(((()))()(()(()()((((((()()))())())()))()(()(())))(()()))()((((()(...
result:
ok 1 cases (1 test case)
Test #26:
score: 0
Accepted
time: 18ms
memory: 7072kb
input:
1 )((((())()(()))(())))))())())()(()))(((()))(()())))(((()((((()(()))))(((()))((((()((()(())))))())()(((((()()))(()((()(()((()()()(())))()))(((()()))()()((((()()(((()(()))())(((()())(()(())((()(()((())()))())())(((((((()))()))())(((()(())))()())(())()())(()))((((())(())))((())((())(((())))()()(()())...
output:
impossible
result:
ok 1 cases (1 test case)
Test #27:
score: 0
Accepted
time: 14ms
memory: 7060kb
input:
1 ((())(())(())))((())))()()()((())))((((()()(((()()))))()()()()(((())((()((()))(((((())(())(()())))))))((((()))))())()))((()(((((())))))(()())())))(()(()))(((()((())((()()())(()()((()()()))((((((((()))))(()(()))()((()()())(((())(((())())()))()(((()((((()((())()(()((()(()((((())))(((()))())((((())()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #28:
score: 0
Accepted
time: 17ms
memory: 7036kb
input:
1 )()()((())))))()()())))(()))()(()(())()))))())()(()(()()(((())()))))(())((())()))))))((()()()))()(()(()))))()()()(()()))))())())))))))(((()(())()()))))((()()(((((()(((())())(()(())(())))(()))()()))())((((((((((())(()(()))(()()()()(())(())(()(((()(()))()((()(()))((((())(()()()((()(())))((())((())((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #29:
score: 0
Accepted
time: 14ms
memory: 7120kb
input:
1 (()))(()(()())())(((())()())((())))(())))))))((())()))))())()()))()()))))))())())((()))))))()()()))()())(())))()()(((())())(((())))(()()()(((()((()())))(()))())))))()))(())(())(()))(()()())))()))(((()))(()())))()(((()(((()()))(())()()))()(()()())()()(((((()()()))())))()((())()))(()((()()()()((((((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #30:
score: 0
Accepted
time: 18ms
memory: 7060kb
input:
1 (((()))(()((())()(())()()())()(())()()()()))()(()()))(())(())(())((())(((())(()()))())()))(()((((((())()))(((()))))))()(((()()(())))()()(())))()))()(()())()((()((((()()())()((((((())((((((((())(()()()(()))(((()(()(((((())((()))(((((()(()(((()()(()(())()()((((())))(()))(())())))(())))((((()))()))()...
output:
(((()))(()((())()(())()()())()(())()()()()))()(()()))(())(())(())((())(((())(()()))())()))(()((((((())()))(((()))))))()(((()()(())))()()(())))()))()(()())()((()((((()()())()((((((())((((((((())(()()()(()))(((()(()(((((())((()))(((((()(()(((()()(()(())()()((((())))(()))(())())))(())))((((()))()))()((...
result:
ok 1 cases (1 test case)
Test #31:
score: 0
Accepted
time: 19ms
memory: 7084kb
input:
1 ))()))((())()((()))(()))(())())(()()(())()((((())())()()()()()))))(((()(()(((()(((()(((()())((())(()(())))(()()))((()()((()))()))(()))()))((())())))())(())))()((()())()()((((()()())())))((())()((((()()()())((((((((())))))()()()(()())(())()(()((()()(()())(()(()(())((())((())()(()))())(((()(())(((((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #32:
score: 0
Accepted
time: 3ms
memory: 7152kb
input:
1 )))()()()()((())())))))))))))()(()))()()())((((((()))((())))((())(((())(()())()))))()()))()))((()((()(())(())(())())(((((()())))))(((()(()())()((())))))()(((()((()(((()()((())))))((()(()((())()))()))()(((())))))())(())((((((((()()())()))))(()(()((()()())(())))))())((((()()(())(((())))((()())())(()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #33:
score: 0
Accepted
time: 15ms
memory: 7200kb
input:
1 ((((())))))(()()((((()(())()))))(((()()())()())))(())(())())()(()))(()()()(((()((()))))))(()())))(()((((((((()(((())(()))())))(()())))()(((()))))()()(((()()()((()(()()()((()()((()))()())))()((())()()))()(((((()))((()((())(((()((()()(()))(()))())()()(())((((())())()))()()()())))()(()())))(()()))(((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #34:
score: 0
Accepted
time: 11ms
memory: 7156kb
input:
1 )(()))))))))()(())(((((())))()))())))())))()()(((()((())(()))(())(()())()())(()((())((((())())))())(((()()()()))())())()()((()(((()(()(((())(()((()()()()((()()()())))((()()()(((())))))))))))())()())))((()()())))))(((()()())()))(()))()))())))))))))()(()(()((())))()(()())(()))()()))())((()(()()()(((...
output:
impossible
result:
ok 1 cases (1 test case)
Test #35:
score: 0
Accepted
time: 10ms
memory: 7132kb
input:
1 ))(((()(()((()(((()((())()((((()()))((()(((()(())(((())))((()))))()(())))(((((()())))(())())(()())()(((((()(())()))(((((()(())())))())))(((((()())())()(()())))))())(()))(((((((()((((((((((())))((())(())((()))))()((((())()(())((((()((((()))))))(())(())(()))))()()(())))()((()))(())())())(())())))))(...
output:
impossible
result:
ok 1 cases (1 test case)
Test #36:
score: 0
Accepted
time: 11ms
memory: 7152kb
input:
1 (()()))()(())())()(()))(())()())(()((())))())(()))())()(((()))()()()())()(((()(()(((()))()))((())(()()(((())(())()))()()))((()()))((()((((((((()()(())()(((()))(()()(((()))(((((()()))((((()((()((())((()))))))(((((()(()()())()))))))(()())(((((()()((()))(())(((()((()()(())()()())))())()((()()((((()()...
output:
(()()))()(())())()(()))(())()())(()((())))())(()))())()(((()))()()()())()(((()(()(((()))()))((())(()()(((())(())()))()()))((()()))((()((((((((()()(())()(((()))(()()(((()))(((((()()))((((()((()((())((()))))))(((((()(()()())()))))))(()())(((((()()((()))(())(((()((()()(())()()())))())()((()()((((()()))...
result:
ok 1 cases (1 test case)
Test #37:
score: 0
Accepted
time: 17ms
memory: 7076kb
input:
1 ()))))((((()()()()((())((())((()()((()(((((()()()(((())())))())())()(()))((())((((((())((())()())())()())()()((((()(((())()()))(((()))((((()(()))))(()()()()((())))))(())()(((()))))())())())((()()))())())()((()()()(()()()()(((()()))())(()())(()()(())))(()))))())())(((()))(((())))()()(())))()(((()))...
output:
impossible
result:
ok 1 cases (1 test case)
Test #38:
score: 0
Accepted
time: 11ms
memory: 7140kb
input:
1 )()())())((()((()(())(())(())())(((((()())))))(((()(()())()((())))))()(((()((()(((()()((())))))((()(()((())()))()))()(((())))))())(())((((((((()()())()))))(()(()((()()())(())))))())((((()()(())(((())))((()())())(()(()(()((())()((((())()()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(...
output:
)()())())((()((()(())(())(())())(((((()())))))(((()(()())()((())))))()(((()((()(((()()((())))))((()(()((())()))()))()(((())))))())(())((((((((()()())()))))(()(()((()()())(())))))())((((()()(())(((())))((()())())(()(()(()((())()((((())()()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(()...
result:
ok 1 cases (1 test case)
Test #39:
score: 0
Accepted
time: 15ms
memory: 7060kb
input:
1 (())(((()))))((()()()(()(((((((()()(()((())())(())))))())()((())(())()))(()(()()()(()))(()(())()()(()())))))()())))((()((())()()())())())()))())())()()(())((()))()()(()))))()(())(()()()()()()())()(((()((())())(())))())()(()(())())()()(()()(((())(()(((((())()))(()()())()()())(()(())(()())))()())))(...
output:
(())(((()))))((()()()(()(((((((()()(()((())())(())))))())()((())(())()))(()(()()()(()))(()(())()()(()())))))()())))((()((())()()())())())()))())())()()(())((()))()()(()))))()(())(()()()()()()())()(((()((())())(())))())()(()(())())()()(()()(((())(()(((((())()))(()()())()()())(()(())(()())))()())))(()...
result:
ok 1 cases (1 test case)
Test #40:
score: 0
Accepted
time: 15ms
memory: 7092kb
input:
1 )))))(()((((()))())))()()((())(()()())(()())()))))()(((())))((()()))(((()()(((((()()(()())()(())(((()))))()(()))(())))(()())((()(())())))(()(()(((()((()))(((((())(())(()(()(()())))())(()))()((((()))()())))()())(()()((()()(()()))))))(())(()()(())(())())()()(()))()))))()()()((()(())()))()((())))())(...
output:
)))))(()((((()))())))()()((())(()()())(()())()))))()(((())))((()()))(((()()(((((()()(()())()(())(((()))))()(()))(())))(()())((()(())())))(()(()(((()((()))(((((())(())(()(()(()())))())(()))()((((()))()())))()())(()()((()()(()()))))))(())(()()(())(())())()()(()))()))))()()()((()(())()))()((())))())()(...
result:
ok 1 cases (1 test case)
Test #41:
score: 0
Accepted
time: 11ms
memory: 7156kb
input:
1 )))(()()(())))())()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()()))))))((())()))()(((()))()))(())))(()(((()((((((((()))((())))())())())))()((())))()(((()))()((()())())((()())()))()(()())()())...
output:
)))(()()(())))())()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()()))))))((())()))()(((()))()))(())))(()(((()((((((((()))((())))())())())))()((())))()(((()))()((()())())((()())()))()(()())()()))(...
result:
ok 1 cases (1 test case)
Test #42:
score: 0
Accepted
time: 14ms
memory: 7036kb
input:
1 )))())(())()())))()()()((()))(()))()(((()()()(()))(()()())())(((()(())))()))()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()())))))))((())()))()(((()))())(())))(()(((()((((((((()))((())))())())...
output:
)))())(())()())))()()()((()))(()))()(((()()()(()))(()()())())(((()(())))()))()((((((((()()()(())())()())))((())())()((()))))))(((())()(((()))(((())()(()()())()()))))((()(()(())()()()((())())(()()((())))))))((()(((()((())())())(()())))))))((())()))()(((()))())(())))(()(((()((((((((()))((())))())())()...
result:
ok 1 cases (1 test case)
Test #43:
score: 0
Accepted
time: 19ms
memory: 7156kb
input:
1 )((()()))()()(()))())())()((())(()(())(())(()))))()((()()(()())))()(()((()))())()))()()(())(())((((()((()()()))))))()())()()()()()())(()())()((((()((()(())))()())())())))()())()()())(()((())))()(()())(((((((())))(((())((()())()((()))(()())(()((()()())(())(()((())))((()()()())(()))()))()))))(((((((...
output:
)((()()))()()(()))())())()((())(()(())(())(()))))()((()()(()())))()(()((()))())()))()()(())(())((((()((()()()))))))()())()()()()()())(()())()((((()((()(())))()())())())))()())()()())(()((())))()(()())(((((((())))(((())((()())()((()))(()())(()((()()())(())(()((())))((()()()())(()))()))()))))((((((()(...
result:
ok 1 cases (1 test case)
Test #44:
score: 0
Accepted
time: 18ms
memory: 7128kb
input:
1 )))()(((()()(()))(((())())()()(()()(())))))))(()))((()()))(()))()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(()))()))))()()())(()()))(()((((()))))))())()(()(((()())(()(((()))(()))())))(((((())((((()())((()(((())(()(()))()()())()())))()()(((())())))))))))(((()()()()()()()()(()()))((...
output:
)))()(((()()(()))(((())())()()(()()(())))))))(()))((()()))(()))()()))((()))())()((()())())())(()))(()(()())))(()(()((())))))(()))()))))()()())(()()))(()((((()))))))())()(()(((()())(()(((()))(()))())))(((((())((((()())((()(((())(()(()))()()())()())))()()(((())())))))))))(((()()()()()()()()(()()))(())...
result:
ok 1 cases (1 test case)
Test #45:
score: 0
Accepted
time: 14ms
memory: 7068kb
input:
1 )))())()))))()))(()))()))()((())(())))(()((((()())(((()()(()))()))()))((()((())))(((()()))()))(()))))(()(((((((()))())(()((((())()))(()((())(((()(((()(((()))))(())((()(()()))(()))(((())(()()))((()())((((((()(()())())))))((()))())((((((()(())(()()(()()(()()((((((((())())())(()(()())((((())))())))()...
output:
impossible
result:
ok 1 cases (1 test case)
Test #46:
score: 0
Accepted
time: 15ms
memory: 7152kb
input:
1 (((())))(((()()()()(()))()())()))(()((()()()()())()())))((()())(((()()())(()))(()))()()((()()(())()(())))())(())(()(()()(((()()(())((((()((()))()())()((())(())(()((((())((((())(((((())()((()(())))(()()(()()()))()((((()((())((())())))((()((()(((()())))))((()())((((())()()())((((()())))())()((()))((...
output:
(((())))(((()()()()(()))()())()))(()((()()()()())()())))((()())(((()()())(()))(()))()()((()()(())()(())))())(())(()(()()(((()()(())((((()((()))()())()((())(())(()((((())((((())(((((())()((()(())))(()()(()()()))()((((()((())((())())))((()((()(((()())))))((()())((((())()()())((((()())))())()((()))(()(...
result:
ok 1 cases (1 test case)
Test #47:
score: 0
Accepted
time: 20ms
memory: 7076kb
input:
1 ))((((()))())))(((())()()((()))(((()((())())()((())((((((((()))()()(((())(()((((())()))(()(((())()((())(())(()))(()))()(()()())(())))((())(()()))())))))(()))()(((()())))(()))()())))()()((()(((()))))((()((((())(())(())()())))(()())(((()()(()(())()()()))))()())())))(()((()(()(()())))()))(())))))))((...
output:
))((((()))())))(((())()()((()))(((()((())())()((())((((((((()))()()(((())(()((((())()))(()(((())()((())(())(()))(()))()(()()())(())))((())(()()))())))))(()))()(((()())))(()))()())))()()((()(((()))))((()((((())(())(())()())))(()())(((()()(()(())()()()))))()())())))(()((()(()(()())))()))(())))))))((()...
result:
ok 1 cases (1 test case)
Test #48:
score: 0
Accepted
time: 15ms
memory: 7072kb
input:
1 )))()()(()))()))(()(())())(()())((((())()))(())()(()))))((((((())))((()(())()((((()())(()())())()()(()(())(()(((()))))(()()((())((((((()))(((((()()))()())()))))((())()())((((()))))())())())()))()()()))())))(((()))((()()((((())))((()()()(())((()()()())()())()()()()(((())(()))())(()))()(()(()())())(...
output:
)))()()(()))()))(()(())())(()())((((())()))(())()(()))))((((((())))((()(())()((((()())(()())())()()(()(())(()(((()))))(()()((())((((((()))(((((()()))()())()))))((())()())((((()))))())())())()))()()()))())))(((()))((()()((((())))((()()()(())((()()()())()())()()()()(((())(()))())(()))()(()(()())())(((...
result:
ok 1 cases (1 test case)
Test #49:
score: -100
Time Limit Exceeded
input:
1 ()(((((((((((((((((((((((((((()((((((((((((((((((((((((((((((((((((((((((()())(()((((((((((()((((((((((((((((((()(()()()((((((((((((()(()((()((((((((((()(((((((((((((((())((((((((((((((((((((((((((((((((((((((((((((((())((((((((((()((((((()(((((((((((((((((((((((((()(()(()(((((((((((()((((((((((((...