QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#378405#7683. Hard Brackets ProblemkarunaWA 3ms3812kbC++20314b2024-04-06 12:32:242024-04-06 12:32:26

Judging History

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

  • [2024-04-06 12:32:26]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3812kb
  • [2024-04-06 12:32:24]
  • 提交

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";
	}
}

詳細信息

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)