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,62 @@
package chelper;
import java.util.Arrays;
import io.InputReader;
import io.OutputWriter;
public class D {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.nextInt();
char[] seq = in.nextLine().toCharArray();
int x[] = new int[n];
int y[] = new int[n];
int currentDepth = 0;
int maxDepth = 0;
int w = 0;
for (int i = 0; i < n; i++) {
if (seq[i] == '[') {
currentDepth++;
w++;
}
maxDepth = Math.max(maxDepth, currentDepth);
y[i] = currentDepth;
if (seq[i] == ']') {
currentDepth--;
w++;
if (seq[i - 1] == '[') {
w += 3;
}
}
x[i] = w - 1;
}
int h = maxDepth * 2 + 1;
char[][] answer = new char[h][w];
for (int i = 0; i < h; i++) {
Arrays.fill(answer[i], ' ');
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= maxDepth - y[i]; j++) {
answer[h / 2 - j][x[i]] = '|';
answer[h / 2 + j][x[i]] = '|';
}
answer[h / 2 - (maxDepth - y[i] + 1)][x[i]] = '+';
answer[h / 2 + (maxDepth - y[i] + 1)][x[i]] = '+';
int dx = seq[i] == '[' ? 1 : -1;
answer[h / 2 - (maxDepth - y[i] + 1)][x[i] + dx] = '-';
answer[h / 2 + (maxDepth - y[i] + 1)][x[i] + dx] = '-';
}
for (int i = 0; i < h; i++) {
out.println(new String(answer[i]));
}
}
}

View File

@@ -0,0 +1,74 @@
1 D
6 SINGLE
8 STANDARD
9 input.txt
8 STANDARD
10 output.txt
7
0
10 8
[[][]][]
89 +- -++- -+
|+- -++- -+|| |
|| || ||| |
|+- -++- -+|| |
+- -++- -+
1
1
8 6
[[[]]]
69 +- -+
|+- -+|
||+- -+||
||| |||
||+- -+||
|+- -+|
+- -+
1
2
8 6
[[][]]
64 +- -+
|+- -++- -+|
|| || ||
|+- -++- -+|
+- -+
1
3
4 2
[]
17 +- -+
| |
+- -+
1
4
6 4
[][]
32 +- -++- -+
| || |
+- -++- -+
1
5
19 16
[[[[[][]][]][]]]
-1
1
6
104 100
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
-1
1
11 src/chelper
16 -Xmx256m -Xss64m
4 Main
9 chelper.D
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2017.03.11
0
1
14 io.InputReader
15 io.OutputWriter
0
0