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,39 @@
package chelper;
import java.util.HashSet;
import java.util.Set;
import io.InputReader;
import io.OutputWriter;
import misc.SimpleSavingChelperSolution;
public class A extends SimpleSavingChelperSolution {
public void solve(int testNumber, InputReader in, OutputWriter out) {
wrapSolve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
Set<Integer> lucky = new HashSet<>();
for (int i = 0; i < 10; i++) {
lucky.add(in.nextInt());
}
int n = in.nextInt();
for (int i = 0; i < n; i++) {
int luckyCount = 0;
for (int j = 0; j < 6; j++) {
if (lucky.contains(in.nextInt())) {
luckyCount++;
}
}
out.println(luckyCount >= 3 ? "Lucky" : "Unlucky");
}
}
}

View File

@@ -0,0 +1,31 @@
1 A
6 SINGLE
8 STANDARD
9 input.txt
8 STANDARD
10 output.txt
1
0
69 1 2 3 4 5 6 7 8 9 32
3
1 2 10 11 12 13
1 2 3 10 11 12
32 1 10 20 30 3
19 Unlucky
Lucky
Lucky
1
11 src/chelper
16 -Xmx256m -Xss64m
4 Main
9 chelper.A
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2018.02.18
0
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,84 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
import misc.SimpleSavingChelperSolution;
public class B 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[][] a = new int[2 * n][n];
for (int i = 0; i < 2 * n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = in.nextInt();
}
}
int p1 = -1;
int p2 = -1;
for (int i = 0; i < 2 * n; i++) {
for (int j = i + 1; j < 2 * n; j++) {
if (a[i][0] == a[j][0]) {
p1 = i;
p2 = j;
}
}
}
int[][] res = new int[n][n];
for (int i = 0; i < n; i++) {
res[0][i] = a[p1][i];
res[i][0] = a[p2][i];
}
for (int i = 0; i < 2 * n; i++) {
if (i == p1 || i == p2) {
continue;
}
int p = -1;
for (int j = 0; j < n; j++) {
if (res[0][j] == a[i][0]) {
p = j;
break;
}
}
if (p >= 0) {
for (int j = 0; j < n; j++) {
res[j][p] = a[i][j];
}
continue;
}
for (int j = 0; j < n; j++) {
if (res[j][0] == a[i][0]) {
p = j;
break;
}
}
for (int j = 0; j < n; j++) {
res[p][j] = a[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
out.print(res[i][j] + " ");
}
}
}
}

View File

@@ -0,0 +1,41 @@
1 B
6 SINGLE
8 STANDARD
9 input.txt
8 STANDARD
10 output.txt
2
0
17 2
1 2
1 3
2 4
3 4
7 1 2 3 4
0
1
79 4
1 6 14 7
5 4 1 13
13 16 12 10
8 3 6 16
11 2 7 10
15 9 14 12
4 3 9 2
5 8 15 11
38 5 4 1 13 8 3 6 16 15 9 14 12 11 2 7 10
1
11 src/chelper
16 -Xmx256m -Xss64m
4 Main
9 chelper.B
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2018.02.18
0
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,28 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
import misc.SimpleSavingChelperSolution;
public class C extends SimpleSavingChelperSolution {
public void solve(int testNumber, InputReader in, OutputWriter out) {
wrapSolve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
long mod = 1000000007;
int n = in.nextInt();
long res = 1;
for (int i = 0; i < (n - 1) * (n - 1); i++) {
res = (res * n) % mod;
}
out.println(res);
}
}

View File

@@ -0,0 +1,29 @@
1 C
6 SINGLE
8 STANDARD
9 input.txt
8 STANDARD
10 output.txt
2
0
1 2
1 2
1
1
1 3
2 81
1
11 src/chelper
16 -Xmx256m -Xss64m
4 Main
9 chelper.C
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2018.02.18
0
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,119 @@
package chelper;
import java.util.Arrays;
import java.util.Comparator;
import io.InputReader;
import io.OutputWriter;
import misc.SimpleSavingChelperSolution;
public class D extends SimpleSavingChelperSolution {
public void solve(int testNumber, InputReader in, OutputWriter out) {
wrapSolve(testNumber, in, out);
}
class Pair implements Comparable<Pair> {
public final long first;
public final int second;
public Pair(long first, int second) {
this.first = first;
this.second = second;
}
@Override
public int compareTo(Pair o) {
return Long.compare(first, o.first);
}
}
@Override
public void solve(int testNumber) {
int n = in.nextInt();
int q = in.nextInt();
long[] allVal = new long[n];
for (int i = 0; i < n; i++) {
allVal[i] = in.nextLong();
}
int[][] requests = new int[q][3];
int[][] answers = new int[q][3];
for (int i = 0; i < q; i++) {
requests[i][0] = in.nextInt() - 1;
requests[i][1] = in.nextInt();
requests[i][2] = i;
}
Arrays.sort(requests, Comparator.comparingInt(o -> o[0]));
int N = 110;
long[] set;
for (int[] i : requests) {
int l = i[0];
int r = i[1];
int m = Math.min(N, r - l);
set = Arrays.copyOfRange(allVal, l, l + m);
Arrays.sort(set);
boolean ok = false;
long a1 = -1;
int b1 = -1;
long a2 = -1;
int b2 = -1;
long a3 = -1;
int b3 = -1;
for (int j = 0; j < m - 2; j++) {
if (set[j] + set[j + 1] > set[j + 2]) {
ok = true;
a1 = set[j];
a2 = set[j + 1];
a3 = set[j + 2];
break;
}
}
if (ok) {
for (int j = 0; j < m && (b1 == -1 || b2 == -1 || b3 == -1); j++) {
if (allVal[l + j] == a1 && b1 == -1) {
b1 = l + j + 1;
continue;
}
if (allVal[l + j] == a2 && b2 == -1) {
b2 = l + j + 1;
continue;
}
if (allVal[l + j] == a3 && b3 == -1) {
b3 = l + j + 1;
}
}
answers[i[2]][0] = b1;
answers[i[2]][1] = b2;
answers[i[2]][2] = b3;
}
}
for (int i = 0; i < q; i++) {
if (answers[i][0] == 0) {
out.println(-1);
} else {
out.println(answers[i][0] + " " + answers[i][1] + " " + answers[i][2]);
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,44 @@
package chelper;
import java.util.List;
import java.util.Random;
import io.InputReader;
import io.OutputWriter;
import misc.SimpleSavingChelperSolution;
public class Dgen extends SimpleSavingChelperSolution {
public void solve(int testNumber, InputReader in, OutputWriter out) {
wrapSolve(testNumber, in, out);
}
@Override
public void solve(int testNumber) {
int n = 300000;
int q = 300000;
out.println(n + " " + q);
long[] a = new long[n];
long p = 1;
for (int i = 0; i < n; i++) {
a[i] = p;
out.print(a[i] + " ");
p = (p * 2) % 1000000000000000000L;
}
out.println();
Random random = new Random();
for (int i = 0; i < q; i++) {
int l = random.nextInt(250000) + 1;
out.println(l + " " + (l + 1000));
}
}
}

View File

@@ -0,0 +1,25 @@
4 Dgen
6 SINGLE
8 STANDARD
9 input.txt
8 STANDARD
10 output.txt
1
0
0
-1
1
11 src/chelper
16 -Xmx256m -Xss64m
4 Main
12 chelper.Dgen
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2018.02.18
0
1
14 io.InputReader
15 io.OutputWriter
0
0