Skip to content

Commit 871aa28

Browse files
committed
fix: correct output formatting and implement logic for p2190B1
1 parent 0994faa commit 871aa28

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/main/java/com/lzw/solutions/codeforces/p2190A/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void solve() throws IOException {
4949
}
5050
}
5151
if (positions.size() == 0) {
52-
out.print("Bob");
52+
out.println("Bob");
5353
} else {
5454
out.println("Alice");
5555
int size = positions.size();

src/main/java/com/lzw/solutions/codeforces/p2190B1/Main.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@ public class Main {
1313
// (())
1414
// ((()))
1515
// (()())
16+
// (())()
17+
// (())()
18+
// (()(()))
19+
// (()()(()))
1620

1721
private static void solve() throws IOException {
1822
int t = Integer.parseInt(in.readLine());
1923
while (t-- > 0) {
2024
int n = Integer.parseInt(in.readLine());
2125
String s = in.readLine();
2226
assert (s.length() == n);
23-
out.println(s);
27+
int ans;
28+
if (n == 2) {
29+
ans = -1;
30+
} else {
31+
if (s.contains("()((")) {
32+
ans = n - 2;
33+
} else {
34+
ans = -1;
35+
}
36+
}
37+
out.println(ans);
2438
}
2539
}
2640

0 commit comments

Comments
 (0)