git reimport
This commit is contained in:
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"
|
||||
}
|
Reference in New Issue
Block a user