git reimport

This commit is contained in:
2019-03-15 13:47:54 +04:00
commit 3b461f73de
489 changed files with 1631603 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
package chelper;
import java.util.ArrayList;
import java.util.List;
import io.InputReader;
import io.OutputWriter;
import misc.SimpleSavingChelperSolution;
public class C extends SimpleSavingChelperSolution {
public void solve(int testNumber, InputReader in, OutputWriter out) {
wrapSolve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
int n = in.nextInt();
long k = in.nextLong();
long left = k;
StringBuilder sb = new StringBuilder();
long current = -1;
for (int i = 0; i < n; i++) {
if (current + 1 <= left) {
current++;
left -= current;
sb.append('(');
continue;
}
while (current + 1 > left) {
sb.append(')');
current--;
}
current++;
left -= current;
sb.append('(');
}
while (current + 1 > 0) {
sb.append(')');
current--;
}
if (left > 0) {
out.println("Impossible");
return;
}
out.println(sb.toString());
}
}