Submission #965064

#TimeUsernameProblemLanguageResultExecution timeMemory
965064KasymKMutating DNA (IOI21_dna)C++17
43 / 100
1519 ms3404 KiB
#include "dna.h" #include "bits/stdc++.h" using namespace std; string s, s2; void init(string a, string b){ s = a, s2 = b; } int get_distance(int x, int y){ if(y - x <= 2){ int s_a = 0, s_c = 0, s_t = 0; int s2_a = 0, s2_c = 0, s2_t = 0; for(int i = x; i <= y; ++i){ s_a += (s[i] == 'A'); s_c += (s[i] == 'C'); s_t += (s[i] == 'T'); s2_a += (s2[i] == 'A'); s2_c += (s2[i] == 'C'); s2_t += (s2[i] == 'T'); } if(s_a != s2_a or s_c != s2_c or s_t != s2_t) return -1; int ok = 1; for(int i = x; i <= y; ++i) ok &= (s[i] == s2[i]); if(ok) return 0; int ans = 0; for(int i = x; i <= y; ++i) ans += (s[i] != s2[i]); ans--; return ans; } // galan wagt dine 'A' we 'T' harplar bar int ans = 0; int s_a = 0, s_t = 0; int s2_a = 0, s2_t = 0; for(int i = x; i <= y; ++i){ s_a += (s[i] == 'A'); s_t += (s[i] == 'T'); s2_a += (s2[i] == 'A'); s2_t += (s2[i] == 'T'); } if(s_a != s2_a or s_t != s2_t) return -1; for(int i = x; i <= y; ++i) ans += ((s[i] != s2[i]) or (s[i] != s2[i])); ans >>= 1; return ans; }
#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...