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,41 @@
{
"name" : "A - Nastya Is Reading a Book",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ {
"input" : "3\n1 3\n4 7\n8 11\n2\n",
"output" : "3",
"index" : 0,
"active" : true
}, {
"input" : "3\n1 4\n5 9\n10 12\n9\n",
"output" : "2",
"index" : 1,
"active" : true
}, {
"input" : "1\n1 7\n4\n",
"output" : "1",
"index" : 2,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskA",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.03.11",
"contestName" : "Codeforces Round #546 (Div. 2)",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,41 @@
{
"name" : "B - Nastya Is Playing Computer Games",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ {
"input" : "2 2\n",
"output" : "6",
"index" : 0,
"active" : true
}, {
"input" : "4 2",
"output" : "13",
"index" : 1,
"active" : true
}, {
"input" : "5 1",
"output" : "15",
"index" : 2,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskB",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.03.11",
"contestName" : "Codeforces Round #546 (Div. 2)",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,46 @@
{
"name" : "C - Nastya Is Transposing Matrices",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ {
"input" : "2 2\n1 1\n6 1\n1 6\n1 1\n",
"output" : "YES",
"index" : 0,
"active" : true
}, {
"input" : "2 2\n4 4\n4 5\n5 4\n4 4\n",
"output" : "NO",
"index" : 1,
"active" : true
}, {
"input" : "3 3\n1 2 3\n4 5 6\n7 8 9\n1 4 7\n2 5 6\n3 8 9\n",
"output" : "YES",
"index" : 2,
"active" : true
}, {
"input" : "1 1\n1\n2",
"output" : "NO",
"index" : 3,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskC",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.03.11",
"contestName" : "Codeforces Round #546 (Div. 2)",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,49 @@
{
"name" : "D - Nastya Is Buying Lunch",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD",
"fileName" : "input.txt"
},
"output" : {
"type" : "STANDARD",
"fileName" : "output.txt"
},
"tests" : [ {
"input" : "2 1\n1 2\n1 2\n",
"output" : "1",
"index" : 0,
"active" : true
}, {
"input" : "3 3\n3 1 2\n1 2\n3 1\n3 2\n",
"output" : "2",
"index" : 1,
"active" : true
}, {
"input" : "5 2\n3 1 5 4 2\n5 2\n5 4\n",
"output" : "1",
"index" : 2,
"active" : true
}, {
"input" : "7 7\n1 2 3 4 5 6 7\n4 5\n4 6\n4 7\n2 3\n2 5\n2 6\n2 7",
"output" : "2",
"index" : 3,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskD",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ "chelper.TaskDTestCase" ],
"date" : "2019.03.11",
"contestName" : "Codeforces Round #546 (Div. 2)",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false,
"interactor" : "net.egork.chelper.tester.Interactor"
}

View File

@@ -0,0 +1,26 @@
{
"name" : "E - Nastya Hasn't Written a Legend",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskE",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.03.11",
"contestName" : "Codeforces Round #546 (Div. 2)",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,29 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
import solutions.ChelperSolution;
public class TaskA extends ChelperSolution {
@Override
public void solve(int testNumber, InputReader in, OutputWriter out) {
super.solve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
int n = in.nextInt();
int[][] a = in.nextIntIntArray(n, 2);
int k = in.nextInt();
for (int i = 0; i < n; i++) {
if (a[i][0] <= k && k <= a[i][1]) {
out.println(n - i);
}
}
}
}

View File

@@ -0,0 +1,25 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
import solutions.ChelperSolution;
public class TaskB extends ChelperSolution {
@Override
public void solve(int testNumber, InputReader in, OutputWriter out) {
super.solve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
int n = in.nextInt();
int k = in.nextInt() - 1;
int l = k;
int r = n - l - 1;
out.println(n + Math.min(l, r) + n - 1 + n + 1);
}
}

View File

@@ -0,0 +1,48 @@
package chelper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import io.InputReader;
import io.OutputWriter;
import solutions.ChelperSolution;
public class TaskC extends ChelperSolution {
@Override
public void solve(int testNumber, InputReader in, OutputWriter out) {
super.solve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
int n = in.nextInt();
int m = in.nextInt();
int[][] a = in.nextIntIntArray(n, m);
int[][] b = in.nextIntIntArray(n, m);
boolean ok = true;
for (int diag = 0; diag < n + m - 1; diag++) {
int startI = Math.min(diag, n - 1);
int startJ = Math.max(diag - startI, 0);
List<Integer> la = new ArrayList<>();
List<Integer> lb = new ArrayList<>();
for (int i = startI, j = startJ; i >= 0 && j < m; i--, j++) {
la.add(a[i][j]);
lb.add(b[i][j]);
}
Collections.sort(la);
Collections.sort(lb);
ok &= la.equals(lb);
}
out.println(ok ? "YES" : "NO");
}
}

View File

@@ -0,0 +1,72 @@
package chelper;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import io.InputReader;
import io.OutputWriter;
import solutions.ChelperSolution;
public class TaskD extends ChelperSolution {
public static final long MAGIC = 1000000L;
@Override
public void solve(int testNumber, InputReader in, OutputWriter out) {
super.solve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
int n = in.nextInt();
int m = in.nextInt();
int[] positions = in.nextIntArray(n);
int[][] swaps = in.nextIntIntArray(m, 2);
int[] positionOf = new int[n + 1];
for (int i = 0; i < n; i++) {
positionOf[positions[i]] = i;
}
Set<Long> set = new HashSet<>();
for (int i = 0; i < m; i++) {
int l = positionOf[swaps[i][0]];
int r = positionOf[swaps[i][1]];
set.add(l * MAGIC + r);
}
int nastya = n - 1;
List<Integer> jumpers = new ArrayList<>();
List<Integer> leftovers = new ArrayList<>();
// Set<Integer> jumpers = new HashSet<>();
// Set<Integer> leftovers = new HashSet<>();
leftovers.add(nastya);
for (int i = nastya - 1; i >= 0; i--) {
boolean ok = true;
for (Integer j : leftovers) {
if (!set.contains(i * MAGIC + j)) {
ok = false;
break;
}
}
if (ok) {
jumpers.add(i);
} else {
leftovers.add(i);
}
}
out.println(jumpers.size());
}
}

View File

@@ -0,0 +1,96 @@
package chelper;
import net.egork.chelper.task.Test;
import net.egork.chelper.tester.TestCase;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class TaskDTestCase {
@TestCase
public Collection<Test> createTests() {
List<Test> tests = new ArrayList<>();
tests.add(test1());
tests.add(test2());
tests.add(test3());
return tests;
}
private Test test1() {
StringBuilder in = new StringBuilder();
int n = 300000;
int m = 500000;
in.append(n + " " + m + "\n");
for (int i = 1; i <= n; i++) {
in.append(i + " ");
}
in.append("\n");
int im = m;
for (int i = n; i >= 1; i--) {
for (int j = i + 1; j <= n && im > 0; j++) {
in.append(i + " " + j + "\n");
im--;
}
}
return new Test(in.toString());
}
private Test test2() {
StringBuilder in = new StringBuilder();
int n = 300000;
int m = 0;
in.append(n + " " + m + "\n");
for (int i = 1; i <= n; i++) {
in.append(i + " ");
}
in.append("\n");
int im = m;
for (int i = n; i >= 1; i--) {
for (int j = i + 1; j <= n && im > 0; j++) {
in.append(i + " " + j + "\n");
im--;
}
}
return new Test(in.toString());
}
private Test test3() {
StringBuilder in = new StringBuilder();
int n = 300000;
int m = 500000;
in.append(n + " " + m + "\n");
for (int i = 1; i <= n; i++) {
in.append(i + " ");
}
in.append("\n");
int im = m;
Random random = new Random(0);
for (int i = m; i >= 1 && im > 0; i--) {
int l = random.nextInt(n) + 1;
int r = random.nextInt(n) + 1;
in.append(l + " " + r + "\n");
im--;
}
return new Test(in.toString());
}
}

View File

@@ -0,0 +1,19 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
import solutions.ChelperSolution;
public class TaskE extends ChelperSolution {
@Override
public void solve(int testNumber, InputReader in, OutputWriter out) {
super.solve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
}
}