git reimport
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskA 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");
|
||||
}}
|
Reference in New Issue
Block a user