This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
bitset<4101> dna[4101];
int diff[4101][4101];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, k;
cin >> n >> m >> k;
for (int i = 0; i < n; i++) {
string ln; cin >> ln;
for (int j = 0; j < m; j++) {
if (ln[j] == 'A')
dna[i].set(j);
}
}
for (int a = 0; a < n; a++) {
for (int b = a + 1; b < n; b++) {
diff[a][b] = (dna[a] ^ dna[b]).count();
}
}
for (int a = 0; a < n; a++) {
bool allK = true;
for (int b = 0; b < n; b++) {
if (b != a && diff[min(a, b)][max(a, b)] != k) {
allK = false;
break;
}
}
if (allK) {
cout << (a + 1) << "\n";
return 0;
}
}
cout << "?\n";
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |