File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
src/main/java/com/lzw/solutions/codeforces Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff 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 ();
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments