# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
669805 | Marszpace | Mutating DNA (IOI21_dna) | C++17 | 1585 ms | 3780 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;
vector<bool> diff;
string aGlobal,bGlobal;
void init(string a, string b){
for(int i=0;i<a.size();i++){
diff.push_back(!(a[i]==b[i]));
}
aGlobal=a;
bGlobal=b;
}
int get_distance(int x, int y){
int a[3]={},b[3]={};
for(int i=x;i<=y;i++){
if(aGlobal[i]=='A'){a[0]++;}
else if(aGlobal[i]=='T'){a[1]++;}
else if(aGlobal[i]=='C'){a[2]++;}
if(bGlobal[i]=='A'){b[0]++;}
else if(bGlobal[i]=='T'){b[1]++;}
else if(bGlobal[i]=='C'){b[2]++;}
}
if(a[0]!=b[0]||a[1]!=b[1]||a[2]!=b[2]){return -1;}
int res=0;
for(int i=x;i<=y;i++){
if(diff[i]){res++;}
}
return (res+1)/2;
}
/*
int main(){
init("ATACAT", "ACTATA");
cout << aGlobal << endl << bGlobal << endl;
cout << get_distance(1, 3) << " " << get_distance(4, 5) << " " << get_distance(3, 5);
}
*/
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... |