QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#684271#7683. Hard Brackets Problemucup-team2275TL 35ms3824kbC++17835b2024-10-28 11:56:202024-10-28 11:56:20

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

3
((()))
(
)))()

output:

((()))
impossible
)))()

result:

ok 3 cases (3 test cases)

Test #2:

score: 0
Accepted
time: 26ms
memory: 3792kb

input:

100000
())(()()()
()())()))
)()()()()
())()(())(
((())()))
)(())()))(
)()))())))
)))))(((()
()))((()((
()((()()))
(()())())
())(()))()
(())(())))
))))(()(()
()))(())((
()((())())
()))()))()
()((())())
()()))((()
()))(()))
(()(())))
())((()))
())()((())
(()(())))
()(((()())
))))())))(
((((()()()
(()(...

output:

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: 27ms
memory: 3528kb

input:

200000
(()))
()))(
)()))
(())
)((((
)(())
)(())
()))(
((()(
()(()
))())
)((((
()())
(())
()(()
(()()
)(())
()))
(()()
()())
(())
()()(
(()((
)())
(()()
(())
))(((
(())
())()
())()
(()))
(((((
)())
(()))
()(()
)()()
(()))
()())
(()))
)(())
(())(
))))(
())((
))(((
))))(
()()
()())
(())
(())
(())
)(())...

output:

(()))
impossible
)()))
(())
impossible
)(())
)(())
impossible
impossible
impossible
))())
impossible
()())
(())
impossible
impossible
)(())
()))
impossible
()())
(())
impossible
impossible
)())
impossible
(())
impossible
(())
())()
())()
(()))
impossible
)())
(()))
impossible
)()()
(()))
()())
(()))...

result:

ok 200000 cases (200000 test cases)

Test #4:

score: 0
Accepted
time: 31ms
memory: 3604kb

input:

250000
()()
(())
())
)(((
(()(
(())
)()
(())
(())
))()
)(()
)())
)())
(())
)())
()))
())
(()(
))))
()((
()()
)())
())
())
())
(())
))()
(())
(()(
)))(
()))
())
)))(
)(()
()))
()()
(())
((()
(())
))((
))((
(())
()))
(()(
(())
((()
)(()
(())
((((
())
))()
())
()()
)()(
)()
(())
))()
()))
())
)()
)())
...

output:

()()
(())
())
impossible
impossible
(())
)()
(())
(())
))()
impossible
)())
)())
(())
)())
()))
())
impossible
))))
impossible
()()
)())
())
())
())
(())
))()
(())
impossible
impossible
()))
())
impossible
impossible
()))
()()
(())
impossible
(())
impossible
impossible
(())
()))
impossible
(())
impo...

result:

ok 250000 cases (250000 test cases)

Test #5:

score: 0
Accepted
time: 18ms
memory: 3624kb

input:

50000
)))()((((()(((())(()
)(())()())((())))()(
(((((()))()(((()((()
)()(()())(()())(()()
()(())()()()((())))
)((())))((((())(((((
((())(()()))()(()())
()))())(()))(()())((
))(((())(())()))())
((((()())()))()(((((
((())()))))(((()))))
()()(())((()(()))))
()())())))()()(()))
()))(())()())()(())
()()(...

output:

impossible
impossible
impossible
impossible
()(())()()()((())))
impossible
((())(()()))()(()())
impossible
))(((())(())()))())
impossible
((())()))))(((()))))
()()(())((()(()))))
()())())))()()(()))
()))(())()())()(())
impossible
)))))(())()())((()))
impossible
)(((()())()(())()))
impossible
impossi...

result:

ok 50000 cases (50000 test cases)

Test #6:

score: 0
Accepted
time: 23ms
memory: 3604kb

input:

83333
((()((())(()
(())(()()))
()(()(())))
((((())))))
)())(((())))
()()())()())
()()((())))
(()(()(((())
()((()()()()
(()()()())))
(()()()(((()
)))))()()())
)((()()())))
))(((()))))
()())(()))()
)()))))()())
)(()((())))(
(()())(()))
())()((())))
(()()()(()))
)())()()(())
((())()))(()
(()(()(((())
)...

output:

impossible
(())(()()))
()(()(())))
((((())))))
)())(((())))
()()())()())
()()((())))
impossible
impossible
(()()()())))
impossible
)))))()()())
)((()()())))
))(((()))))
()())(()))()
)()))))()())
impossible
(()())(()))
())()((())))
(()()()(()))
)())()()(())
impossible
impossible
impossible
impossible...

result:

ok 83333 cases (83333 test cases)

Test #7:

score: 0
Accepted
time: 35ms
memory: 3604kb

input:

250000
)))
)(((
()()
((()
((()
())
())(
))((
)())
()()
()()
())
((()
())
()()
(())
(())
()()
()))
())
)())
()()
)()
())
)()(
(())
)()
)(((
))()
(())
)()
)())
)()
)()
))((
()()
(())
()((
))((
)(((
()))
)())
)())
)())
)())
)(((
())
)))
(())
(())
())(
())
(())
(())
()()
())(
()()
())
))()
(())
(())
)()...

output:

)))
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: 14ms
memory: 3632kb

input:

50000
(())((()()(())(((()(
()()()((((()())())))
(())(()()()((())))()
(())(()))(()(()()))
()((((()((())))))))
)))())))()()())()))(
()(()))(((())()(((((
()()())())(((()())))
(())(())))(()((())))
()(()(())()()()()(((
()()()((()(()()))))
)(())))()(())()())()
)((((((()())())((())
)()())(()((()(()))))
(()...

output:

impossible
()()()((((()())())))
(())(()()()((())))()
(())(()))(()(()()))
()((((()((())))))))
impossible
impossible
()()())())(((()())))
(())(())))(()((())))
impossible
()()()((()(()()))))
)(())))()(())()())()
impossible
)()())(()((()(()))))
(())(()()())()())())
)())()()()()((())())
(())()((())((()))...

result:

ok 50000 cases (50000 test cases)

Test #9:

score: 0
Accepted
time: 23ms
memory: 3540kb

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: 32ms
memory: 3760kb

input:

250000
)())
()))
())(
(())
()()
())
))((
())
)()
())
()((
()))
(())
)(((
())
(())
))()
)())
(()(
)()
((((
()))
)))(
(()(
()()
))))
)())
()()
((()
)(((
()()
(())
)(()
()()
)()
)))(
())
())(
())
)))(
))()
())
)())
))((
())
()))
((()
)()(
)()
()))
())
)())
(())
(()(
()()
()))
()))
)))(
()))
)()
())
())...

output:

)())
()))
impossible
(())
()()
())
impossible
())
)()
())
impossible
()))
(())
impossible
())
(())
))()
)())
impossible
)()
impossible
()))
impossible
impossible
()()
))))
)())
()()
impossible
impossible
()()
(())
impossible
()()
)()
impossible
())
impossible
())
impossible
))()
())
)())
impossible
...

result:

ok 250000 cases (250000 test cases)

Test #11:

score: 0
Accepted
time: 22ms
memory: 3540kb

input:

50000
(())(()(()(())))())
())()()))(())()()())
())()())((()(()))))
()(()()))(()((())))
()))))()))((()((()))
()(())())())(()))())
((()((()((())))())))
())()))()()()())))))
(((()()))))))()(())
))(()((())((((()((((
()((()()(((()()()())
(()())(()(()))())))
()()))))(()(()()()))
())()())(((()(()))))
()(((...

output:

(())(()(()(())))())
())()()))(())()()())
())()())((()(()))))
()(()()))(()((())))
impossible
()(())())())(()))())
((()((()((())))())))
())()))()()()())))))
(((()()))))))()(())
impossible
impossible
(()())(()(()))())))
()()))))(()(()()()))
())()())(((()(()))))
()((()(()))()(())))
impossible
()))())(()...

result:

ok 50000 cases (50000 test cases)

Test #12:

score: 0
Accepted
time: 23ms
memory: 3792kb

input:

83333
())()))))(()
(()((()(()))
((((((()())(
())(((((()))
((())((())))
)())())))))(
()(((())((()
()(((()))))
(()))((()))
)(())())((((
)()()()(())
)(()))(())))
)(((()())))
)(())(()()))
(())))(()))(
(((((()))))(
))((()()())(
(((()))())()
(((()()((())
())))))(((((
()((((()))))
)()(()))(())
(()))(()()))...

output:

impossible
impossible
impossible
impossible
((())((())))
impossible
impossible
()(((()))))
(()))((()))
impossible
)()()()(())
)(()))(())))
)(((()())))
)(())(()()))
impossible
impossible
impossible
(((()))())()
impossible
impossible
()((((()))))
)()(()))(())
(()))(()()))
)())))()()))
impossible
(())(...

result:

ok 83333 cases (83333 test cases)

Test #13:

score: 0
Accepted
time: 31ms
memory: 3824kb

input:

250000
(())
((((
(())
())
()()
(())
(())
())
))()
(())
))()
(())
()))
))))
(())
()))
()))
())
)()(
)))
)())
(())
(())
))()
(())
())
()))
))()
))((
)()
()()
)(((
(())
()()
)()
)(()
())
)())
((()
))()
)(((
()))
())
())
)())
()))
)())
(())
))()
))))
)())
())
))()
)()(
))))
((((
())
(())
)()
)())
())
()...

output:

(())
impossible
(())
())
()()
(())
(())
())
))()
(())
))()
(())
()))
))))
(())
()))
()))
())
impossible
)))
)())
(())
(())
))()
(())
())
()))
))()
impossible
)()
()()
impossible
(())
()()
)()
impossible
())
)())
impossible
))()
impossible
()))
())
())
)())
()))
)())
(())
))()
))))
)())
())
))()
impo...

result:

ok 250000 cases (250000 test cases)

Test #14:

score: 0
Accepted
time: 18ms
memory: 3628kb

input:

50000
))(())())())()(()(()
)((())((()()))(())))
()(()(()))()(()()))
((()())()())(()(()))
)()()(())())()(())()
(()(()(((())))()()))
((()))()()(()(()((()
()()()()(())(((())))
)))))((((()()()()(((
((())((()()(())))))
(((((()()()(()))))))
())())))())())()(())
((())((((((())))))))
((())()())())()()())
()...

output:

impossible
)((())((()()))(())))
()(()(()))()(()()))
((()())()())(()(()))
)()()(())())()(())()
(()(()(((())))()()))
impossible
()()()()(())(((())))
impossible
((())((()()(())))))
(((((()()()(()))))))
())())))())())()(())
((())((((((())))))))
((())()())())()()())
()((((()(((())))))))
()())(((()))((())...

result:

ok 50000 cases (50000 test cases)

Test #15:

score: 0
Accepted
time: 20ms
memory: 3552kb

input:

83333
)))((())(()(
()((()))())
(()))()(()((
))((()()(()(
(()))()()))
)))()()(()((
)(()))()()((
())((()))))
(())))()())
)(()()))(()(
()(()()))()
()))())())((
((()(()())))
(((())()()()
()(())(()())
))())((()))
())((()()(()
))(()((())))
((((()()))))
(()((())())(
)()())(())()
))(()())()))
(()(())(()()
(...

output:

impossible
()((()))())
impossible
impossible
(()))()()))
impossible
impossible
())((()))))
(())))()())
impossible
()(()()))()
impossible
((()(()())))
impossible
()(())(()())
))())((()))
impossible
))(()((())))
((((()()))))
impossible
)()())(())()
))(()())()))
impossible
())(())()()
impossible
imposs...

result:

ok 83333 cases (83333 test cases)

Test #16:

score: -100
Time Limit Exceeded

input:

1
(()()((((())))(((((((())(()())())()(()((()(((()(()))))())((())((())((()))()())(()))()))((())()())))()())()(()((())(((()()(((())(((()))(((()())((()(((()())()())(()(()(())()()())())(((((((()((((()))()())())((((()(()())()())))((()((((()(((((()((((())()(()(()((((()()(((())())())))(())))))))))((((()(()...

output:


result: