QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#656710#7683. Hard Brackets ProblemnidehgWA 69ms3804kbC++20469b2024-10-19 13:35:442024-10-19 13:35:45

Judging History

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

  • [2024-10-19 13:35:45]
  • 评测
  • 测评结果:WA
  • 用时:69ms
  • 内存:3804kb
  • [2024-10-19 13:35:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N = 1000010;

int t;

void solve(){
	string s;
	cin >> s;
	int cnt1 = 0, cnt2 = 0;
	vector<char> a;
	for (auto v : s){
		if (v == '('){
			cnt1 ++ ;
		}
		else {
			cnt2 ++ ;
		}
		a.push_back(v);
	}
	if (cnt1 <= cnt2){
		for (auto v : a){
			cout << v;
		}
		cout << '\n';
	}
	else {
		cout << "impossible\n";
	}
}

int main(){
	cin >> t;
	while (t -- ) solve();
	return 0;
}

详细

Test #1:

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

input:

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

output:

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

result:

ok 3 cases (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 69ms
memory: 3604kb

input:

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

output:

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

result:

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