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;
vector<int> permN(n);
iota(permN.begin(), permN.end(), 0);
random_shuffle(permN.begin(), permN.end());
vector<int> permM(m);
iota(permM.begin(), permM.end(), 0);
random_shuffle(permM.begin(), permM.end());
for (int i = 0; i < n; i++) {
string ln; cin >> ln;
for (int j = 0; j < m; j++) {
if (ln[j] == 'A')
dna[permN[i]].set(permM[j]);
}
}
for (int a = 0; a < n; a++) {
bool ok = true;
for (int b = 0; b < n; b++) {
if (a != b && (dna[a] ^ dna[b]).count() != k) {
ok = false;
break;
}
}
if (ok) {
cout << (find(permN.begin(), permN.end(), a) - permN.begin() + 1) << "\n";
return 0;
}
}
cout << "?\n";
return 1;
}
Compilation message (stderr)
genetics.cpp: In function 'int main()':
genetics.cpp:35:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (a != b && (dna[a] ^ dna[b]).count() != k) {
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
# | 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... |