git reimport
This commit is contained in:
@@ -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
|
||||
}
|
@@ -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
|
||||
}
|
@@ -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
|
||||
}
|
@@ -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"
|
||||
}
|
@@ -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
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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");
|
||||
}
|
||||
}
|
@@ -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());
|
||||
}
|
||||
}
|
@@ -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());
|
||||
}
|
||||
}
|
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
29
archive/2019.03/2019.03.14 - Yandex.Interview/A.java
Normal file
29
archive/2019.03/2019.03.14 - Yandex.Interview/A.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class A extends ChelperSolution {
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
super.solve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
String a = in.nextLine();
|
||||
String b = in.nextLine();
|
||||
|
||||
int c = 0;
|
||||
for (char c1 : b.toCharArray()) {
|
||||
if (a.contains("" + c1)) {
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
out.println(c);
|
||||
}
|
||||
}
|
34
archive/2019.03/2019.03.14 - Yandex.Interview/A.json
Normal file
34
archive/2019.03/2019.03.14 - Yandex.Interview/A.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name" : "A",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "ab\naabbccd",
|
||||
"output" : "4",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.A",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2019.03.14",
|
||||
"contestName" : "Yandex.Interview",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
35
archive/2019.03/2019.03.14 - Yandex.Interview/B.java
Normal file
35
archive/2019.03/2019.03.14 - Yandex.Interview/B.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class B 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 maxLength = 0;
|
||||
int curLength = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
int x = in.nextInt();
|
||||
|
||||
if (x == 0) {
|
||||
curLength = 0;
|
||||
} else {
|
||||
curLength++;
|
||||
maxLength = Math.max(curLength, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
out.println(maxLength);
|
||||
}
|
||||
}
|
34
archive/2019.03/2019.03.14 - Yandex.Interview/B.json
Normal file
34
archive/2019.03/2019.03.14 - Yandex.Interview/B.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name" : "B",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "5\n1\n0\n1\n0\n1",
|
||||
"output" : "1",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.B",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2019.03.14",
|
||||
"contestName" : "Yandex.Interview",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
39
archive/2019.03/2019.03.14 - Yandex.Interview/C.java
Normal file
39
archive/2019.03/2019.03.14 - Yandex.Interview/C.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class C 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 prev = 0;
|
||||
boolean first = true;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (i % 100000 == 0) {
|
||||
System.gc();
|
||||
}
|
||||
|
||||
int cur = in.nextInt();
|
||||
|
||||
if (!first && cur == prev) {
|
||||
continue;
|
||||
}
|
||||
|
||||
out.println(cur);
|
||||
|
||||
first = false;
|
||||
prev = cur;
|
||||
}
|
||||
}
|
||||
}
|
39
archive/2019.03/2019.03.14 - Yandex.Interview/C.json
Normal file
39
archive/2019.03/2019.03.14 - Yandex.Interview/C.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name" : "C",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "5\n2\n4\n8\n8\n8",
|
||||
"output" : "2\n4\n8",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "5\n2\n2\n2\n8\n8",
|
||||
"output" : "2\n8",
|
||||
"index" : 1,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.C",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ "chelper.CTestCase" ],
|
||||
"date" : "2019.03.14",
|
||||
"contestName" : "Yandex.Interview",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
40
archive/2019.03/2019.03.14 - Yandex.Interview/CTestCase.java
Normal file
40
archive/2019.03/2019.03.14 - Yandex.Interview/CTestCase.java
Normal file
@@ -0,0 +1,40 @@
|
||||
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.List;
|
||||
|
||||
public class CTestCase {
|
||||
@TestCase
|
||||
public Collection<Test> createTests() {
|
||||
List<Test> tests = new ArrayList<>();
|
||||
|
||||
StringBuilder test, answer;
|
||||
|
||||
{
|
||||
test = new StringBuilder();
|
||||
answer = new StringBuilder();
|
||||
makeTest1(test, answer);
|
||||
if (answer.length() == 0) {
|
||||
tests.add(new Test(test.toString()));
|
||||
} else {
|
||||
tests.add(new Test(test.toString(), answer.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
||||
void makeTest1(StringBuilder test, StringBuilder answer) {
|
||||
int n = 1000000;
|
||||
|
||||
test.append(n).append('\n');
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
test.append(i).append('\n');
|
||||
}
|
||||
}
|
||||
}
|
34
archive/2019.03/2019.03.14 - Yandex.Interview/E.java
Normal file
34
archive/2019.03/2019.03.14 - Yandex.Interview/E.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class E extends ChelperSolution {
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
super.solve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
String a = in.nextString();
|
||||
String b = in.nextString();
|
||||
|
||||
int[] countsA = new int[256];
|
||||
for (char c : a.toCharArray()) {
|
||||
countsA[c]++;
|
||||
}
|
||||
|
||||
int[] countsB = new int[256];
|
||||
for (char c : b.toCharArray()) {
|
||||
countsB[c]++;
|
||||
}
|
||||
|
||||
out.println(Arrays.equals(countsA, countsB) ? 1 : 0);
|
||||
}
|
||||
}
|
39
archive/2019.03/2019.03.14 - Yandex.Interview/E.json
Normal file
39
archive/2019.03/2019.03.14 - Yandex.Interview/E.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name" : "E",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "qiu\niuq",
|
||||
"output" : "1",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "zprl\nzprc",
|
||||
"output" : "0",
|
||||
"index" : 1,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.E",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2019.03.14",
|
||||
"contestName" : "Yandex.Interview",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
108
archive/2019.03/2019.03.15 - Yandex.Interview/D.java
Normal file
108
archive/2019.03/2019.03.15 - Yandex.Interview/D.java
Normal file
@@ -0,0 +1,108 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class D extends ChelperSolution {
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
super.solve(testNumber, in, out);
|
||||
}
|
||||
|
||||
boolean[] merge(boolean[] a, boolean[] b) {
|
||||
int n = a.length;
|
||||
int m = b.length;
|
||||
|
||||
boolean[] c = new boolean[n + m + 2];
|
||||
|
||||
c[0] = true;
|
||||
for (int i = 0; i < n; i++) {
|
||||
c[1 + i] = a[i];
|
||||
}
|
||||
c[n + 1] = false;
|
||||
|
||||
for (int i = 0; i < m; i++) {
|
||||
c[n + 2 + i] = b[i];
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public static final int N = 11;
|
||||
|
||||
public void rawPrint(boolean[] a) {
|
||||
// for (boolean i : a) {
|
||||
// out.print(i ? '(' : ')');
|
||||
// }
|
||||
// out.println();
|
||||
for (boolean i : a) {
|
||||
System.out.write(i ? '(' : ')');
|
||||
}
|
||||
System.out.write('\n');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
List<List<boolean[]>> dp = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i <= N; i++) {
|
||||
dp.add(new ArrayList<>());
|
||||
}
|
||||
|
||||
dp.get(0).add(new boolean[0]);
|
||||
|
||||
for (int i = 1; i <= N; i++) {
|
||||
for (int l1 = 0; l1 <= i - 1; l1++) {
|
||||
int l2 = i - 1 - l1;
|
||||
|
||||
List<boolean[]> dp1 = dp.get(l1);
|
||||
List<boolean[]> dp2 = dp.get(l2);
|
||||
|
||||
for (boolean[] a : dp1) {
|
||||
for (boolean[] b : dp2) {
|
||||
dp.get(i).add(merge(a, b));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i <= N; i++) {
|
||||
Collections.sort(dp.get(i), new Comparator<boolean[]>() {
|
||||
@Override
|
||||
public int compare(boolean[] o1, boolean[] o2) {
|
||||
for (int i = 0; i < o1.length; i++) {
|
||||
if (o1[i] && !o2[i]) {
|
||||
return -1;
|
||||
}
|
||||
if (!o1[i] && o2[i]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
// out.println(i + ":");
|
||||
// out.println(dp.get(i).size());
|
||||
// for (boolean[] a : dp.get(i)) {
|
||||
// rawPrint(a);
|
||||
// }
|
||||
}
|
||||
|
||||
int n = in.nextInt();
|
||||
for (boolean[] b : dp.get(n)) {
|
||||
rawPrint(b);
|
||||
}
|
||||
|
||||
System.out.flush();
|
||||
}
|
||||
}
|
39
archive/2019.03/2019.03.15 - Yandex.Interview/D.json
Normal file
39
archive/2019.03/2019.03.15 - Yandex.Interview/D.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name" : "D",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "2",
|
||||
"output" : "(())\n()()",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "3",
|
||||
"output" : "((()))\n(()())\n(())()\n()(())\n()()()",
|
||||
"index" : 1,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.D",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2019.03.15",
|
||||
"contestName" : "Yandex.Interview",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
74
archive/2019.03/2019.03.15 - Yandex.Interview/F.java
Normal file
74
archive/2019.03/2019.03.15 - Yandex.Interview/F.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package chelper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class F extends ChelperSolution {
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
super.solve(testNumber, in, out);
|
||||
}
|
||||
|
||||
int rawReadInt() {
|
||||
try {
|
||||
int res = 0;
|
||||
|
||||
while (true) {
|
||||
char c = (char) System.in.read();
|
||||
|
||||
if ('0' <= c && c <= '9') {
|
||||
res = res * 10 + c - '0';
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
int maxDecimalPower(int x) {
|
||||
int d = 1;
|
||||
while (d * 10 <= x) {
|
||||
d *= 10;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
void rawPrintSpace(int x) {
|
||||
int d = maxDecimalPower(x);
|
||||
|
||||
while (d > 0) {
|
||||
System.out.write(x / d % 10 + '0');
|
||||
d /= 10;
|
||||
}
|
||||
System.out.write(' ');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int[] counts = new int[101];
|
||||
|
||||
int k = rawReadInt();
|
||||
int c = 0;
|
||||
|
||||
for (int i = 0; i < k; i++) {
|
||||
int m = rawReadInt();
|
||||
|
||||
for (int j = 0; j < m; j++) {
|
||||
counts[rawReadInt()]++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 101; i++) {
|
||||
for (int j = 0; j < counts[i]; j++) {
|
||||
rawPrintSpace(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
archive/2019.03/2019.03.15 - Yandex.Interview/F.json
Normal file
38
archive/2019.03/2019.03.15 - Yandex.Interview/F.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name" : "F",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "4\n6 2 26 64 88 96 96\n4 8 20 65 86\n7 1 4 16 42 58 61 69\n1 84",
|
||||
"output" : "1 2 4 8 16 20 26 42\n58 61 64 65 69 84 86\n88 96 96 ",
|
||||
"index" : 0,
|
||||
"active" : false
|
||||
}, {
|
||||
"input" : "",
|
||||
"index" : 1,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.F",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2019.03.15",
|
||||
"contestName" : "Yandex.Interview",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
Reference in New Issue
Block a user