# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
437033 | 2021-06-25T16:23:02 Z | WnRS | Mutating DNA (IOI21_dna) | C++17 | 0 ms | 0 KB |
#include "dna.h" #include <bits/stdc++.h> using namespace std; string a,b; int get_distance(int x, int y) { int cnt=0, a=0,t=0,c=0; for(int i = x ; i <= y ; i++) { if(a[i] != b[i]) cnt++; if(a[i]=='A') a++; else if(a[i] == 'T') t++; else c++; if(b[i]=='A') a--; else if(b[i]=='T') t--; else c--; } return (!a&&!t&&!c?(cnt+1)/2:-1); } void init(string aa, string bb) { a=aa,b=bb; }