# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
630254 | GoodkNight | Mutating DNA (IOI21_dna) | C++17 | 39 ms | 6248 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 <string>
#include<iostream>
using namespace std;
int presum[100008][6];
void init(string a, string b){
for(int i=0; i<a.size(); i++){
if(i>0){
for(int j=0; j<6; j++){
presum[i][j]=presum[i-1][j];
}
}
if(a[i]=='A'){
if(b[i]=='C'){
presum[i][0]++;
}
if(b[i]=='T'){
presum[i][1]++;
}
}
if(a[i]=='C'){
if(b[i]=='A'){
presum[i][2]++;
}
if(b[i]=='T'){
presum[i][3]++;
}
}
if(a[i]=='T'){
if(b[i]=='A'){
presum[i][4]++;
}
if(b[i]=='C'){
presum[i][5]++;
}
}
}
}
int get_distance(int x, int y){
int mut[6];
for(int i=0; i<6; i++){
if(x>0){
mut[i]=presum[y][i]-presum[x-1][i];
}
else{
mut[i]=presum[y][i];
}
}
if(mut[0]-mut[2]==mut[3]-mut[5]&&mut[0]-mut[2]==mut[4]-mut[1]){
return (2*max(mut[0], mut[2])+min(mut[1], mut[4])+min(mut[3], mut[5])-min(mut[0], mut[2]));
}
else{
return(-1);
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |