git reimport
This commit is contained in:
100
archive/2018.09/2018.09.20 - unsorted/TaskFGen.java
Normal file
100
archive/2018.09/2018.09.20 - unsorted/TaskFGen.java
Normal 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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
32
archive/2018.09/2018.09.20 - unsorted/TaskFGen.json
Normal file
32
archive/2018.09/2018.09.20 - unsorted/TaskFGen.json
Normal 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
|
||||
}
|
Reference in New Issue
Block a user