QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394581#7683. Hard Brackets Problemucup-team228#WA 7ms3592kbC++17399b2024-04-20 16:24:242024-04-20 16:24:24

Judging History

你现在查看的是最新测评结果

  • [2024-04-20 16:24:24]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3592kb
  • [2024-04-20 16:24:24]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin >> t;
    while (t--) {
        string s;
        cin >> s;
        if (count(s.begin(), s.end(), '(') > count(s.begin(), s.end(), ')')) {
            cout << "impossible\n";
        } else {
            cout << s << '\n';
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok 3 cases (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 3592kb

input:

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

output:

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

result:

wrong answer the result string is incorrect (test case 1)