# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
240584 | dsjong | Genetics (BOI18_genetics) | C++14 | 2070 ms | 39032 KiB |
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>
using namespace std;
int n, m, k;
char a[5000][5000];
bitset<4105>bs[4105];
bool check(int x){
for(int i=1;i<=n;i++){
if(i==x) continue;
int cnt=0;
for(int j=0;j<m;j++){
if(a[x][j]!=a[i][j]) cnt++;
}
if(cnt!=k) return false;
}
return true;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>m>>k;
for(int i=1;i<=n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}
}
if(n<=100){
for(int i=1;i<=n;i++){
if(check(i)){
cout<<i;
return 0;
}
}
}
for(int i=1;i<=n;i++){
for(int j=0;j<m;j++){
bs[i][j]=(a[i][j]=='A');
assert(a[i][j]=='A' || a[i][j]=='C');
}
//cout<<bs[i]<<endl;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i==j) continue;
bitset<4105> tmp=(bs[i]^bs[j]);
//cout<<i<<" "<<j<<" "<<tmp.count()<<endl;
if(tmp.count()!=k) goto hell;
}
cout<<i;
return 0;
hell:;
}
}
Compilation message (stderr)
# | 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... |