QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629192 | #7683. Hard Brackets Problem | wsxcb# | WA | 7ms | 3556kb | C++17 | 488b | 2024-10-11 08:35:20 | 2024-10-11 08:35:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=3e5+5;
int a[N],b[N],n,c[N],d[N];
#define pb push_back
void solve()
{
string s; cin >> s;
int cnt = 0;
for(int i = 0 ; i < s.size() ; i++){
cnt += (s[i] == '(' ? 1 : -1);
}
if(cnt > 0){
cout << "impossible\n";
}
else {
cout << s << '\n';
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t=1;
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: 3552kb
input:
3 ((())) ( )))()
output:
((())) impossible )))()
result:
ok 3 cases (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 7ms
memory: 3556kb
input:
100000 ())(()()() ()())())) )()()()() ())()(())( ((())())) )(())()))( )()))()))) )))))(((() ()))((()(( ()((()())) (()())()) ())(()))() (())(()))) ))))(()(() ()))(())(( ()((())()) ()))()))() ()((())()) ()()))((() ()))(())) (()(()))) ())((())) ())()((()) (()(()))) ()(((()()) ))))())))( ((((()()() (()(...
output:
())(()()() ()())())) )()()()() ())()(())( ((())())) )(())()))( )()))()))) )))))(((() impossible ()((()())) (()())()) ())(()))() (())(()))) ))))(()(() ()))(())(( ()((())()) ()))()))() ()((())()) ()()))((() ()))(())) (()(()))) ())((())) ())()((()) (()(()))) impossible ))))())))( impossible impossible ...
result:
wrong answer the result string is incorrect (test case 1)