This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
ll const inf = 1e9;
ll const mod = 1e9 + 7;
ld const eps = 1e-9;
bitset<4101> a[4101];
int main()
{
int n, m, k;
cin >> n >> m >> k;
fr(i, 0, n){
string s;
cin >> s;
fr(j, 0, m){
if(s[j] == 'A') a[i][j] = 1;
}
}
bitset<4101> op;
fr(i, 0, n){
bool ok = true;
fr(j, 0, n){
if(i == j) continue;
op = a[i]^a[j];
if(op.count() != k){
ok = false;
break;
}
}
if(ok){
cout << i + 1<< endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}
Compilation message (stderr)
genetics.cpp: In function 'int main()':
genetics.cpp:35:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(op.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... |