git reimport
This commit is contained in:
47
archive/2018.11/2018.11.03 - unsorted/BUDDYNIM.java
Normal file
47
archive/2018.11/2018.11.03 - unsorted/BUDDYNIM.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class BUDDYNIM extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int m = in.nextInt();
|
||||
|
||||
List<Integer> a = new ArrayList<>();
|
||||
for (int i = 0; i < n; i++) {
|
||||
int e = in.nextInt();
|
||||
if (e > 0) {
|
||||
a.add(e);
|
||||
}
|
||||
}
|
||||
Collections.sort(a);
|
||||
|
||||
List<Integer> b = new ArrayList<>();
|
||||
for (int i = 0; i < m; i++) {
|
||||
int e = in.nextInt();
|
||||
if (e > 0) {
|
||||
b.add(e);
|
||||
}
|
||||
}
|
||||
Collections.sort(b);
|
||||
|
||||
if (a.equals(b)) {
|
||||
out.println("Bob");
|
||||
} else {
|
||||
out.println("Alice");
|
||||
}
|
||||
}
|
||||
}
|
49
archive/2018.11/2018.11.03 - unsorted/BUDDYNIM.json
Normal file
49
archive/2018.11/2018.11.03 - unsorted/BUDDYNIM.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name" : "BUDDYNIM",
|
||||
"testType" : "MULTI_NUMBER",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "3\n3 1\n1 1 1\n3\n3 1\n1 2 4\n7\n1 1\n1\n1",
|
||||
"output" : "Alice\nAlice\nBob",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n3 3\n1 2 3\n1 3 2",
|
||||
"output" : "Bob",
|
||||
"index" : 1,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "2\n1 1\n0\n0\n1 1\n0\n1",
|
||||
"output" : "Bob\nAlice",
|
||||
"index" : 2,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n2 1\n0 0\n0",
|
||||
"output" : "Bob",
|
||||
"index" : 3,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.BUDDYNIM",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2018.11.03",
|
||||
"contestName" : "",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
67
archive/2018.11/2018.11.03 - unsorted/CHQUEENS.java
Normal file
67
archive/2018.11/2018.11.03 - unsorted/CHQUEENS.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class CHQUEENS extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int m = in.nextInt();
|
||||
int x = in.nextInt() - 1;
|
||||
int y = in.nextInt() - 1;
|
||||
|
||||
// int[] a = {
|
||||
// x - 1,
|
||||
// Math.min(x - 1, m - y),
|
||||
// m - y,
|
||||
// Math.min(m - y, n - x),
|
||||
// n - x,
|
||||
// Math.min(n - x, y - 1),
|
||||
// y - 1,
|
||||
// Math.min(y - 1, x - 1),
|
||||
// };
|
||||
|
||||
int res = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (i == x && j == y) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int canSee = 0;
|
||||
|
||||
// canSee += i;
|
||||
// canSee += Math.min(i, m - j - 1);
|
||||
// canSee += m - j - 1;
|
||||
// canSee += Math.min(m - j - 1, n - i - 1);
|
||||
// canSee += n - i - 1;
|
||||
// canSee += Math.min(n - i - 1, j);
|
||||
// canSee += j;
|
||||
// canSee += Math.min(j, i);
|
||||
|
||||
if (i == x && j < y) canSee += y - j - 1; else canSee += m - j - 1;
|
||||
if (i < x && j == y) canSee += x - i - 1; else canSee += n - i - 1;
|
||||
if (i == x && j > y) canSee += j - y - 1; else canSee += j;
|
||||
if (i > x && j == y) canSee += i - x - 1; else canSee += i;
|
||||
|
||||
|
||||
if (i < x && x - i == y - j) canSee += x - i - 1; else canSee += Math.min(n - i - 1, m - j - 1);
|
||||
if (i < x && x - i == j - y) canSee += x - i - 1; else canSee += Math.min(n - i - 1, j);
|
||||
if (i > x && i - x == j - y) canSee += i - x - 1; else canSee += Math.min(i, j);
|
||||
if (i > x && i - x == y - j) canSee += i - x - 1; else canSee += Math.min(i, m - j - 1);
|
||||
|
||||
res += n * m - canSee - 2;
|
||||
}
|
||||
}
|
||||
|
||||
out.println(res);
|
||||
}
|
||||
}
|
34
archive/2018.11/2018.11.03 - unsorted/CHQUEENS.json
Normal file
34
archive/2018.11/2018.11.03 - unsorted/CHQUEENS.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name" : "CHQUEENS",
|
||||
"testType" : "MULTI_NUMBER",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "2\n3 3 2 2\n4 4 2 3",
|
||||
"output" : "24\n94",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.CHQUEENS",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2018.11.03",
|
||||
"contestName" : "",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
74
archive/2018.11/2018.11.03 - unsorted/INVENTRY.java
Normal file
74
archive/2018.11/2018.11.03 - unsorted/INVENTRY.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class INVENTRY extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int[] spaces = new int[n + 2];
|
||||
int spn = 0;
|
||||
|
||||
char[] chars = in.nextString().toCharArray();
|
||||
|
||||
int t = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (chars[i] == '#') {
|
||||
spaces[spn++] = t;
|
||||
t = 0;
|
||||
} else {
|
||||
t++;
|
||||
}
|
||||
}
|
||||
spaces[spn++] = t;
|
||||
|
||||
int res = 0;
|
||||
|
||||
for (int i = 0; i < spn - 1; ) {
|
||||
if (spaces[i] == 0) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spaces[i + 1] >= 1) {
|
||||
res += spaces[i];
|
||||
spaces[i + 1] += spaces[i];
|
||||
spaces[i] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
// spaces[i + 1] == 0
|
||||
int need = 0;
|
||||
|
||||
for (int j = i + 1; j < spn; j++) {
|
||||
if (spaces[j] == 0) {
|
||||
spaces[j] = 1;
|
||||
need++;
|
||||
}
|
||||
if (spaces[j] > 1) {
|
||||
int available = spaces[j] - 1;
|
||||
int take = Math.min(need, available);
|
||||
spaces[j] -= take;
|
||||
need -= take;
|
||||
if (need == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
res += need;
|
||||
}
|
||||
if (need != 0) {
|
||||
out.println(-1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
out.println(res);
|
||||
}
|
||||
}
|
94
archive/2018.11/2018.11.03 - unsorted/INVENTRY.json
Normal file
94
archive/2018.11/2018.11.03 - unsorted/INVENTRY.json
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"name" : "INVENTRY",
|
||||
"testType" : "MULTI_NUMBER",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "1\n11\n...###.....",
|
||||
"output" : "15",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "3\n6\n##.#..\n7\n.#.#.#.\n5\n##.##",
|
||||
"output" : "1\n6\n-1",
|
||||
"index" : 1,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "6\n5\n.....\n5\n#....\n5\n##...\n5\n###..\n5\n####.\n5\n#####",
|
||||
"output" : "0\n0\n0\n0\n0\n0",
|
||||
"index" : 2,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n2\n.#",
|
||||
"output" : "-1",
|
||||
"index" : 3,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n3\n.#.",
|
||||
"output" : "1",
|
||||
"index" : 4,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n10\n........#.",
|
||||
"output" : "8",
|
||||
"index" : 5,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n9\n.#.#.#.#..",
|
||||
"output" : "10",
|
||||
"index" : 6,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n12\n.##.##.##...",
|
||||
"output" : "-1",
|
||||
"index" : 7,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "3\n4\n##.#\n1\n#\n7\n##.##..",
|
||||
"output" : "-1\n0\n4",
|
||||
"index" : 8,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n7\n.#.##..",
|
||||
"output" : "7",
|
||||
"index" : 9,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n13\n.##.##.##....",
|
||||
"output" : "30",
|
||||
"index" : 10,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "1\n5\n##.##",
|
||||
"output" : "-1",
|
||||
"index" : 11,
|
||||
"active" : true
|
||||
}, {
|
||||
"input" : "3\n3\n.#.\n5\n.#.#.\n7\n.#.#.#.",
|
||||
"output" : "1\n3\n6",
|
||||
"index" : 12,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.INVENTRY",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2018.11.03",
|
||||
"contestName" : "",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
18
archive/2018.11/2018.11.03 - unsorted/PAINTREE.java
Normal file
18
archive/2018.11/2018.11.03 - unsorted/PAINTREE.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class PAINTREE extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
|
||||
}
|
||||
}
|
29
archive/2018.11/2018.11.03 - unsorted/PAINTREE.json
Normal file
29
archive/2018.11/2018.11.03 - unsorted/PAINTREE.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name" : "PAINTREE",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.PAINTREE",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2018.11.03",
|
||||
"contestName" : "",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
21
archive/2018.11/2018.11.03 - unsorted/STRTF.java
Normal file
21
archive/2018.11/2018.11.03 - unsorted/STRTF.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class STRTF extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int q = in.nextInt();
|
||||
|
||||
// int[] a = in.nextInt();
|
||||
}
|
||||
}
|
29
archive/2018.11/2018.11.03 - unsorted/STRTF.json
Normal file
29
archive/2018.11/2018.11.03 - unsorted/STRTF.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name" : "STRTF",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.STRTF",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2018.11.03",
|
||||
"contestName" : "",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
21
archive/2018.11/2018.11.20 - unsorted/TaskTest.java
Normal file
21
archive/2018.11/2018.11.20 - unsorted/TaskTest.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskTest extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
StringBuilder sb;
|
||||
}
|
||||
}
|
34
archive/2018.11/2018.11.20 - unsorted/TaskTest.json
Normal file
34
archive/2018.11/2018.11.20 - unsorted/TaskTest.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name" : "TaskTest",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "",
|
||||
"output" : "",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.TaskTest",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2018.11.20",
|
||||
"contestName" : "",
|
||||
"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