Submission #831946

#TimeUsernameProblemLanguageResultExecution timeMemory
831946JoksimKaktusMutating DNA (IOI21_dna)C++17
22 / 100
1590 ms2424 KiB
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <cmath> #include <queue> #include <map> #include <algorithm> #include <iomanip> #include <set> #include "dna.h" #include <cstdio> #include <cassert> #include <string> using namespace std; string A; string B; void init(string a,string b){ A = a; B = b; } int get_distance(int x, int y){ vector <int> v(6,0); for(int i = x; i <= y;i++){ if(A.at(i) == 'A'){ if(B.at(i) == 'T'){ v[2]++; }else if(B.at(i) == 'C'){ v[0]++; } }else if(A.at(i) == 'C'){ if(B.at(i) == 'A'){ v[1]++; }else if(B.at(i) == 'T'){ v[4]++; } }else{ if(B.at(i) == 'A'){ v[3]++; }else if(B.at(i) == 'C'){ v[5]++; } } } if(abs(v[0] - v[1]) == abs(v[2] - v[3]) && abs(v[0] - v[1]) == abs(v[4] - v[5])){ int res = 0; res += min(v[0],v[1]); res += min(v[2],v[3]); res += min(v[4],v[5]); res += abs(v[0] - v[1]) * 2; return res; }else{ return -1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...