# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
135677 | Plurm | Genetics (BOI18_genetics) | C++11 | 2036 ms | 20124 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;
char dna[4200][4200];
bitset<4200> enc1[4200];
bitset<4200> enc2[4200];
int cnt[4200][4];
inline int getMask(int x){
switch(x){
case 'A':
return 0;
case 'T':
return 1;
case 'C':
return 2;
case 'G':
return 3;
}
}
int main(){
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
for(int i = 1; i <= n; i++){
scanf("%s",dna[i]+1);
for(int j = 1; j <= m; j++){
cnt[j][getMask(dna[i][j])]++;
if(dna[i][j] == 'A' || dna[i][j] == 'T'){
enc1[i][j] = 0;
}else{
enc1[i][j] = 1;
}
if(dna[i][j] == 'A' || dna[i][j] == 'C'){
enc2[i][j] = 0;
}else{
enc2[i][j] = 1;
}
}
}
vector<int> v;
for(int i = 1; i <= n; i++){
int diffcnt = 0;
int ccnt = 0;
int nx = i % n + 1;
for(int j = 1; j <= m; j++){
diffcnt += n - cnt[j][getMask(dna[i][j])];
if(dna[i][j] != dna[nx][j]) ccnt++;
}
if(true){
v.push_back(i);
}
}
for(int i : v){
bool ok = true;
for(int o = 1; o <= n; o++){
if(o == i) continue;
int cur = ((enc1[i] ^ enc1[o]) | (enc2[i] ^ enc2[o])).count();
if(cur != k){
ok = false;
break;
}
}
if(ok){
printf("%d\n",i);
return 0;
}
}
}
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... |