QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629192#7683. Hard Brackets Problemwsxcb#WA 7ms3556kbC++17488b2024-10-11 08:35:202024-10-11 08:35:21

Judging History

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

  • [2024-10-11 08:35:21]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3556kb
  • [2024-10-11 08:35:20]
  • 提交

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)