QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#378405 | #7683. Hard Brackets Problem | karuna | WA | 3ms | 3812kb | C++20 | 314b | 2024-04-06 12:32:24 | 2024-04-06 12:32:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int T; cin >> T;
while (T--) {
string S; cin >> S;
int s = 0;
for (char c : S) {
s += (c == '(') ? 1 : -1;
}
if (s <= 0) cout << S << '\n';
else cout << "impossible\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3812kb
input:
3 ((())) ( )))()
output:
((())) impossible )))()
result:
ok 3 cases (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3540kb
input:
100000 ())(()()() ()())())) )()()()() ())()(())( ((())())) )(())()))( )()))()))) )))))(((() ()))((()(( ()((()())) (()())()) ())(()))() (())(()))) ))))(()(() ()))(())(( ()((())()) ()))()))() ()((())()) ()()))((() ()))(())) (()(()))) ())((())) ())()((()) (()(()))) ()(((()()) ))))())))( ((((()()() (()(...
output:
())(()()() ()())())) )()()()() ())()(())( ((())())) )(())()))( )()))()))) )))))(((() impossible ()((()())) (()())()) ())(()))() (())(()))) ))))(()(() ()))(())(( ()((())()) ()))()))() ()((())()) ()()))((() ()))(())) (()(()))) ())((())) ())()((()) (()(()))) impossible ))))())))( impossible impossible ...
result:
wrong answer the result string is incorrect (test case 1)