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 - Gennady and a Card Game",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ {
"input" : "AS\n2H 4C TH JH AD",
"output" : "YES",
"index" : 0,
"active" : true
}, {
"input" : "2H\n3D 4C AC KD AS\n",
"output" : "NO",
"index" : 1,
"active" : true
}, {
"input" : "4D\nAS AC AD AH 5H\n",
"output" : "YES",
"index" : 2,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskA",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.02.27",
"contestName" : "Hello 2019",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,41 @@
{
"name" : "B - Petr and a Combination Lock",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ {
"input" : "3\n10\n20\n30\n",
"output" : "YES",
"index" : 0,
"active" : true
}, {
"input" : "3\n10\n10\n10\n",
"output" : "NO",
"index" : 1,
"active" : true
}, {
"input" : "3\n120\n120\n120\n",
"output" : "YES",
"index" : 2,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskB",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.02.27",
"contestName" : "Hello 2019",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,41 @@
{
"name" : "C - Yuhao and a Parenthesis",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ {
"input" : "7\n)())\n)\n((\n((\n(\n)\n)\n",
"output" : "2",
"index" : 0,
"active" : true
}, {
"input" : "4\n(\n((\n(((\n(())\n",
"output" : "0",
"index" : 1,
"active" : true
}, {
"input" : "2\n(())\n()\n",
"output" : "1",
"index" : 2,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskC",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.02.27",
"contestName" : "Hello 2019",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,45 @@
{
"name" : "D - Makoto and a Blackboard",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ {
"input" : "6 1",
"output" : "3",
"index" : 0,
"active" : false
}, {
"input" : "6 2",
"output" : "875000008\n",
"index" : 1,
"active" : false
}, {
"input" : "60 5",
"output" : "237178099\n",
"index" : 2,
"active" : false
}, {
"input" : "978217616376000 1",
"index" : 3,
"active" : true
} ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskD",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.02.27",
"contestName" : "Hello 2019",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,26 @@
{
"name" : "E - Egor and an RPG game",
"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.02.27",
"contestName" : "Hello 2019",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,26 @@
{
"name" : "F - Alex and a TV Show",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ ],
"location" : "src/chelper",
"vmArgs" : "-Xmx256M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskF",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.02.27",
"contestName" : "Hello 2019",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,26 @@
{
"name" : "G - Vladislav and a Great Legend",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ ],
"location" : "src/chelper",
"vmArgs" : "-Xmx512M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskG",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.02.27",
"contestName" : "Hello 2019",
"truncate" : true,
"inputClass" : "io.InputReader",
"outputClass" : "io.OutputWriter",
"includeLocale" : false,
"failOnOverflow" : false,
"interactive" : false
}

View File

@@ -0,0 +1,26 @@
{
"name" : "H - Mateusz and an Infinite Sequence",
"testType" : "SINGLE",
"input" : {
"type" : "STANDARD"
},
"output" : {
"type" : "STANDARD"
},
"tests" : [ ],
"location" : "src/chelper",
"vmArgs" : "-Xmx512M",
"mainClass" : "Main",
"taskClass" : "chelper.TaskH",
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
"checkerParameters" : "",
"testClasses" : [ ],
"date" : "2019.02.27",
"contestName" : "Hello 2019",
"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) {
String hand = in.nextString();
boolean ok = false;
for (int i = 0; i < 5; i++) {
String s = in.nextString();
ok |= s.charAt(0) == hand.charAt(0);
ok |= s.charAt(1) == hand.charAt(1);
}
out.println(ok ? "YES" : "NO");
}
}

View File

@@ -0,0 +1,41 @@
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[] a = in.nextIntArray(n);
boolean ok = false;
for (int mask = 0; mask < 1 << n; mask++) {
int res = 0;
int t = mask;
for (int i = 0; i < n; i++) {
if ((t & 1) == 0) {
res += a[i];
} else {
res -= a[i];
}
t /= 2;
}
res = (res % 360 + 360) % 360;
ok |= res == 0;
}
out.println(ok ? "YES" : "NO");
}
}

View File

@@ -0,0 +1,58 @@
package chelper;
import java.util.HashMap;
import java.util.Map;
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 equals = 0;
Map<Integer, Integer> counts = new HashMap<>();
for (int i = 0; i < n; i++) {
String s = in.nextString();
int balance = 0;
int min = 0;
for (char c : s.toCharArray()) {
if (c == '(') {
balance++;
} else {
balance--;
}
min = Math.min(min, balance);
}
if (min == 0 && balance == 0) {
equals++;
continue;
}
if ((min == 0 && balance > 0) || (min < 0 && balance == min)) {
counts.put(balance, 1 + counts.getOrDefault(balance, 0));
}
}
int res = equals / 2;
for (Map.Entry<Integer, Integer> entry : counts.entrySet()) {
if (entry.getKey() > 0) {
res += Math.min(entry.getValue(), counts.getOrDefault(-entry.getKey(), 0));
}
}
out.println(res);
}
}

View File

@@ -0,0 +1,77 @@
package chelper;
import java.util.List;
import java.util.Map;
import io.InputReader;
import io.OutputWriter;
import prep.Algo;
import prep.LongMod;
import solutions.ChelperSolution;
public class TaskD extends ChelperSolution {
@Override
public void solve(int testNumber, InputReader in, OutputWriter out) {
super.solve(testNumber, in, out);
}
LongMod mod = new LongMod(1_000_000_007L);
long[][] matmul(long[][] a, long[][] b) {
int n = a.length;
long[][] c = new long[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < n; k++) {
c[i][j] = mod.sum(
c[i][j],
mod.prod(a[i][k], b[k][j])
);
}
}
}
return c;
}
long[][] matpow(long[][] a, int b) {
if (b == 1) {
return a;
}
if (b % 2 == 0) {
long[][] c = matpow(a, b / 2);
return matmul(c, c);
} else {
return matmul(
a,
matpow(a, b - 1)
);
}
}
// public long solvePrime(long prime, int power, int k) {
//
// }
@Override
public void solve(int testNumber) {
long n = in.nextLong();
int k = in.nextInt();
Map<Long, Integer> factorization = Algo.dumbFactorize(n);
long answer = 1;
for (Map.Entry<Long, Integer> entry : factorization.entrySet()) {
long prime = entry.getKey();
int power = entry.getValue();
}
}
}

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) {
}
}

View File

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

View File

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

View File

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