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 @@
33 A - Bear and Friendship Condition
6 SINGLE
8 STANDARD
-1
8 STANDARD
-1
4
0
16 4 3
1 3
3 4
1 4
4 YES
1
1
20 4 4
3 1
2 3
3 4
1 2
3 NO
1
2
22 10 4
4 3
5 10
8 9
1 2
4 YES
1
3
12 3 2
1 2
2 3
3 NO
1
11 src/chelper
8 -Xmx256M
4 Main
13 chelper.TaskA
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2017.03.18
21 VK Cup 2017 - Round 1
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,39 @@
28 B - Bear and Different Names
6 SINGLE
8 STANDARD
-1
8 STANDARD
-1
3
0
25 8 3
NO NO YES YES YES NO
42 Adam Bob Bob Cpqepqwer Limak Adam Bob Adam
1
1
11 9 8
YES NO
45 R Q Ccccccccc Ccocc Ccc So Strong Samples Ccc
1
2
10 3 2
NO NO
8 Na Na Na
1
11 src/chelper
8 -Xmx256M
4 Main
13 chelper.TaskB
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2017.03.18
21 VK Cup 2017 - Round 1
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,58 @@
23 C - Bear and Tree Jumps
6 SINGLE
8 STANDARD
-1
8 STANDARD
-1
3
0
24 6 2
1 2
1 3
2 4
2 5
4 6
3 20
1
1
58 13 3
1 2
3 2
4 2
5 2
3 6
10 6
6 7
6 13
5 8
5 9
9 11
11 12
4 114
1
2
12 3 5
2 1
3 1
2 3
1
11 src/chelper
8 -Xmx256M
4 Main
13 chelper.TaskC
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2017.03.18
21 VK Cup 2017 - Round 1
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,56 @@
20 D - Bear and Company
6 SINGLE
8 STANDARD
-1
8 STANDARD
-1
5
0
7 4
VKVK
2 3
1
1
8 5
BVVKV
2 2
1
2
10 7
VVKEVKK
2 3
1
3
24 20
VKVKVVVKVOVKVQKKKVVK
2 8
1
4
8 5
LIMAK
2 0
1
11 src/chelper
8 -Xmx256M
4 Main
13 chelper.TaskD
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2017.03.18
21 VK Cup 2017 - Round 1
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,45 @@
29 E - Bear and Rectangle Strips
6 SINGLE
8 STANDARD
-1
8 STANDARD
-1
3
0
42 6
70 70 70 70 70 -15
90 -60 -30 30 -30 15
2 3
1
1
19 4
0 -1 0 0
0 0 1 0
2 6
1
2
68 3
1000000000 999999999 -1000000000
999999999 -1000000000 -999999998
2 1
1
11 src/chelper
8 -Xmx256M
4 Main
13 chelper.TaskE
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2017.03.18
21 VK Cup 2017 - Round 1
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,49 @@
30 F - Bear and Isomorphic Points
6 SINGLE
8 STANDARD
-1
8 STANDARD
-1
1
0
109 4
4
5 3
0 1
10 1
3 51
3
-999123 700000
-950000 123456
-950000 987654
3
2 3
10 -1
-4 6
5
1 3
5 2
6 1
4 4
-3 3
73 250.000000000000
100000000000.000000000000
0.000000000000
6.562500000000
1
11 src/chelper
8 -Xmx256M
4 Main
13 chelper.TaskF
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2017.03.18
21 VK Cup 2017 - Round 1
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,9 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class TaskA {
public void solve(int testNumber, InputReader in, OutputWriter out) {
}
}

View File

@@ -0,0 +1,9 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class TaskB {
public void solve(int testNumber, InputReader in, OutputWriter out) {
}
}

View File

@@ -0,0 +1,128 @@
package chelper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import io.InputReader;
import io.OutputWriter;
public class TaskC {
int n, k;
List<List<Integer>> edges;
long ans = 0;
long[] rotCount(long[] x) {
long[] res = new long[k];
for (int i = 0; i < k; i++) {
res[i] = x[(i - 1 + k) % k];
}
return res;
}
long[] rotAcc(long[] x) {
long[] res = new long[k];
for (int i = 0; i < k; i++) {
res[i] = x[(i - 1 + k) % k];
}
return res;
}
long[] copy(long[] x) {
return Arrays.copyOf(x, k);
}
void add(long[] a, long[] b) {
for (int i = 0; i < k; i++) {
a[i] += b[i];
}
}
public void solve(int testNumber, InputReader in, OutputWriter out) {
n = in.nextInt();
k = in.nextInt();
visited = new boolean[n];
edges = new ArrayList<>();
for (int i = 0; i < n; i++) {
edges.add(new ArrayList<>());
}
for (int i = 0; i < n - 1; i++) {
int a = in.nextInt() - 1;
int b = in.nextInt() - 1;
edges.get(a).add(b);
edges.get(b).add(a);
}
// long[] count = new long[k];
long[] acc = new long[k];
Result ans = dfs(0, 0, acc);
out.println(ans.cost / 2);
}
class Result {
long cost;
long[] acc;
public Result(long cost, long[] acc) {
this.cost = cost;
this.acc = acc;
}
}
boolean[] visited;
// void addComp(long[] a, long[] b) {
// for (int i = 0; i < k; i++) {
// for (int j = 0; j < k; j++) {
// if (i == j) {
// continue;
// }
// long t = a[i] + b[j];
// if (i + j >= k) {
// ans += ;
// }
// }
// }
// }
Result dfs(int v, long parentCost, long[] accParent) {
visited[v] = true;
long costParentChildren = parentCost;
long costChildren = 0;
long[] accParentChildren = new long[k];
costParentChildren += rot(accParentChildren, accParent);
accParentChildren[0] += 1;
long[] accChildren = new long[k];
accChildren[0] += 1;
for (Integer child : edges.get(v)) {
if (visited[child]) {
continue;
}
Result atChild = dfs(child, costParentChildren, accParentChildren);
long[] childAcc = new long[k];
costChildren += atChild.cost;
costChildren += rot(childAcc, atChild.acc);
costParentChildren += atChild.cost;
costParentChildren += rot(childAcc, atChild.acc);
add(accParentChildren, childAcc);
add(accChildren, childAcc);
}
return new Result(costChildren, accChildren);
}
}

View File

@@ -0,0 +1,43 @@
package chelper;
import java.util.Arrays;
import io.InputReader;
import io.OutputWriter;
public class TaskD {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.nextInt();
char[] a = in.nextString().toCharArray();
char c1 = 'V';
char c2 = 'K';
int[][] dp = new int[n][3];
for (int i = 0; i < n; i++) {
Arrays.fill(dp[i], 100000);
}
if (a[0] == c1) {
dp[0][0] = 0;
} else if (a[0] == c2) {
dp[0][1] = 0;
} else {
dp[0][2] = 0;
}
for (int i = 1; i < n; i++) {
if (a[i] == c1) {
dp[i][2] = Math.min(dp[i][2], dp[i - 1][0]);
dp[i][2] = Math.min(dp[i][2], dp[i - 1][1]);
dp[i][2] = Math.min(dp[i][2], dp[i - 1][2]);
} else if (a[i] == c2) {
} else {
dp[i][2] = Math.min(dp[i][2], dp[i - 1][0]);
dp[i][2] = Math.min(dp[i][2], dp[i - 1][1]);
dp[i][2] = Math.min(dp[i][2], dp[i - 1][2]);
}
}
}
}

View File

@@ -0,0 +1,9 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class TaskE {
public void solve(int testNumber, InputReader in, OutputWriter out) {
}
}

View File

@@ -0,0 +1,9 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class TaskF {
public void solve(int testNumber, InputReader in, OutputWriter out) {
}
}