git reimport
This commit is contained in:
62
archive/2018.03/2018.03.24 - unsorted/A.java
Normal file
62
archive/2018.03/2018.03.24 - unsorted/A.java
Normal file
@@ -0,0 +1,62 @@
|
||||
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) {
|
||||
int n = in.nextInt();
|
||||
int m = in.nextInt();
|
||||
|
||||
boolean[][] a = new boolean[n][m];
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
String s = in.nextString();
|
||||
for(int j = 0; j < m; j++) {
|
||||
a[i][j] = s.charAt(j) == '#';
|
||||
}
|
||||
}
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
Set<Integer> atBaseLine = new HashSet<>();
|
||||
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (a[i][j]) {
|
||||
atBaseLine.add(j);
|
||||
}
|
||||
}
|
||||
|
||||
for (int ii = i + 1; ii < n; ii++) {
|
||||
Set<Integer> atNextLine = new HashSet<>();
|
||||
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (a[ii][j]) {
|
||||
atNextLine.add(j);
|
||||
}
|
||||
}
|
||||
|
||||
Set<Integer> intersection = new HashSet<>(atBaseLine);
|
||||
intersection.retainAll(atNextLine);
|
||||
|
||||
if (!intersection.isEmpty() && !atBaseLine.equals(atNextLine)) {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out.println(ok ? "Yes" : "No");
|
||||
}
|
||||
}
|
21
archive/2018.03/2018.03.24 - unsorted/A.task
Normal file
21
archive/2018.03/2018.03.24 - unsorted/A.task
Normal file
@@ -0,0 +1,21 @@
|
||||
1 A
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
9 input.txt
|
||||
8 STANDARD
|
||||
10 output.txt
|
||||
0
|
||||
11 src/chelper
|
||||
16 -Xmx256m -Xss64m
|
||||
4 Main
|
||||
9 chelper.A
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2018.03.24
|
||||
0
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
Reference in New Issue
Block a user