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,9 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class SnarkA {
public void solve(int testNumber, InputReader in, OutputWriter out) {
}
}

View File

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

View File

@@ -0,0 +1,138 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class SnarkB {
int[][] directions = {
{0, 1},
{0, -1},
{1, 0},
{-1, 0}
};
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.nextInt();
int m = in.nextInt();
int N = in.nextInt();
int M = in.nextInt();
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
String s = in.nextString();
for (int j = 0; j < m; j++) {
if (s.charAt(j) == 'O') {
a[i][j] = 1;
}
}
}
int mini = n;
int minj = n;
int maxi = 0;
int maxj = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (a[i][j] != 1) {
continue;
}
mini = Math.min(mini, i);
minj = Math.min(minj, j);
maxi = Math.max(maxi, i);
maxj = Math.max(maxj, j);
}
}
int n2 = maxi - mini + 1;
int m2 = maxj - minj + 1;
int[][] a2 = new int[n2][m2];
for (int i = 0; i < n2; i++) {
for (int j = 0; j < m2; j++) {
a2[i][j] = a[i + mini][j + minj];
}
}
int[][] A = new int[N][M];
for (int i = 0; i < N; i++) {
String s = in.nextString();
for (int j = 0; j < M; j++) {
if (s.charAt(j) == 'O') {
A[i][j] = 1;
}
}
}
int ans = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
boolean bounds = true;
for (int factor = 1; factor < 1000 && bounds; factor++) {
boolean ok = true;
for (int ii = 0; ii < n2 * factor && ok && bounds; ii++) {
for (int jj = 0; jj < m2 * factor && ok && bounds; jj++) {
if (ii + i >= N || jj + j >= M) {
bounds = false;
ok = false;
break;
}
int io = ii / factor;
int jo = jj / factor;
if (a2[io][jo] != 1) {
continue;
}
if (A[ii + i][jj + j] != 1) {
ok = false;
break;
}
for (int[] direction : directions) {
int ii2 = ii + direction[0];
int jj2 = jj + direction[1];
int val1 = -1;
int val2 = -1;
if (ii2 + i < 0 || jj2 + j < 0 || ii2 + i >= N || jj2 + j >= M) {
val2 = 0;
} else {
val2 = A[ii2 + i][jj2 + j];
}
int io2 = ii2 / factor;
int jo2 = jj2 / factor;
if (io2 < 0 || jo2 < 0 || io2 >= n2 || jo2 >= m2 || ii2 < 0 || jj2 < 0) {
val1 = 0;
} else {
val1 = a2[io2][jo2];
}
if (val1 != val2) {
ok = false;
break;
}
}
}
}
if (ok) {
ans++;
}
}
}
}
out.println(ans);
}
}

View File

@@ -0,0 +1,72 @@
6 SnarkB
6 SINGLE
8 STANDARD
9 input.txt
8 STANDARD
10 output.txt
3
0
91 3 3 9 7
.OO
OOO
.O.
..OOOO.
..OOOO.
OOOOOO.
OOOOOO.
..OO...
..OO...
...OO..
..OOO..
...O...
1 0
1
1
100 3 3 10 7
.OO
OOO
.O.
..OOOO.
..OOOO.
OOOOOO.
OOOOOO.
..OO...
..OO...
.......
...O...
..OOO..
...OO..
1 1
1
2
114 4 3 10 8
.OO
OOO
.O.
...
.OO.....
OOO...OO
.O...OOO
......O.
..OOOO..
..OOOO..
OOOOOO..
OOOOOO..
..OO....
..OO....
1 3
1
11 src/chelper
16 -Xmx256m -Xss64m
4 Main
14 chelper.SnarkB
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2016.08.31
0
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,29 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class SnarkD {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.nextInt();
for (int i = 0; i < n; i++) {
double l = in.nextInt() / 2.0;
double r = in.nextInt();
if (r < l) {
out.println(Math.PI * r * r);
continue;
}
if (r > l * Math.sqrt(2)) {
out.println(4 * l * l);
continue;
}
double a = Math.acos(1.0 * l / r);
out.println((Math.PI - 4 * a) * r * r + l * Math.sin(a) * r * 4);
}
}
}

View File

@@ -0,0 +1,33 @@
6 SnarkD
6 SINGLE
8 STANDARD
9 input.txt
8 STANDARD
10 output.txt
2
0
11 2
2 2
42 24
12 4.00
1621.20
1
1
5 1
1 3
1 1
1
11 src/chelper
16 -Xmx256m -Xss64m
4 Main
14 chelper.SnarkD
39 net.egork.chelper.checkers.TokenChecker
0
0
10 2016.08.31
0
1
14 io.InputReader
15 io.OutputWriter
0
0

View File

@@ -0,0 +1,28 @@
package chelper;
import io.InputReader;
import io.OutputWriter;
public class SnarkE {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.nextInt();
boolean[][] a = new boolean[n][n];
for (int i = 0; i < n; i++) {
String s = in.nextString();
for (int j = 0; j < n; j++) {
a[i][j] = s.charAt(j) == '1';
}
}
int[][] dpi = new int[n][n];
int[][] dpj = new int[n][n];
for (int i = n - 1; i >= 0; i--) {
for (int j = 0; j < n; j++) {
dpi[i][j] = a[i][j] ? 1 : 0;
}
}
}
}

View File

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