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,100 @@
package chelper;
import static chelper.TaskF.INF;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import io.InputReader;
import io.OutputWriter;
import misc.SimpleSavingChelperSolution;
public class TaskFGen extends SimpleSavingChelperSolution {
public static final int N = 100000;
public static final int M = 100020;
public static final int Q = 100000;
public static final int MAX_D = 1000000000;
public void solve(int testNumber, InputReader in, OutputWriter out) {
wrapSolve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
boolean input = true;
if (input) {
out.println(N);
out.println(M);
}
Random random = new Random(0);
Map<Integer, Map<Integer, Long>> edges = new HashMap<>();
for (int i = 0; i < N; i++) {
edges.put(i, new HashMap<>());
}
for (int i = 0; i < N - 1; i++) {
long c = random.nextInt(MAX_D) + 1;
edges.get(i).put(i + 1, c);
edges.get(i + 1).put(i, c);
if (input) {
out.println((i + 1) + " " + (i + 2) + " " + c);
}
edges.get(i).put(i, 0L);
}
for (int i = 0; i < M - N + 1; i++) {
long c = random.nextInt(MAX_D) + 1;
int a = random.nextInt(N);
int b = a;
while (b == a || edges.get(a).containsKey(b)) {
b = random.nextInt(N);
}
edges.get(a).put(b, c);
edges.get(b).put(a, c);
if (input) {
out.println((a + 1) + " " + (b + 1) + " " + c);
}
}
// for (int k : edges.keySet()) {
// for (int i : edges.keySet()) {
// for (int j : edges.keySet()) {
// edges.get(i).put(j, Math.min(
// edges.get(i).getOrDefault(j, INF),
// edges.get(i).getOrDefault(k, INF) + edges.get(k).getOrDefault(j, INF)
// ));
// }
// }
// }
if (input) {
out.println(Q);
}
for (int i = 0; i < Q; i++) {
int a = random.nextInt(N);
int b = a;
while (b == a) {
b = random.nextInt(N);
}
if (input) {
out.println((a + 1) + " " + (b + 1));
}
if (!input) {
out.println(edges.get(a).get(b));
}
}
}
}

View File

@@ -0,0 +1,32 @@
{
"name" : "TaskFGen",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD",
"fileName" : "input.txt"
},
"output" : {
"type" : "STANDARD",
"fileName" : "output.txt"
},
"tests" : [ {
"input" : "",
"index" : 0,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256m -Xss64m",
"mainClass" : "Main",
"taskClass" : "chelper.TaskFGen",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2018.09.20",
"contestName" : "",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}