Submission #714528

#TimeUsernameProblemLanguageResultExecution timeMemory
714528mseebacherMutating DNA (IOI21_dna)C++17
43 / 100
1568 ms2976 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; #define MAXI (int)1e5 #define pb(x) push_back(x) int s1[(int)1e5+5]; int s2[(int)1e5+5]; int mp(char c){ if(c == 'A') return 0; if(c == 'T') return 1; return 2; } void init(string x,string y){ for(int i = 0;i<(int)x.length();i++) s1[i] = mp(x[i]); for(int i = 0;i<(int)y.length();i++) s2[i] = mp(y[i]); } int get_distance(int x,int y){ map<int,int> m1,m2; m1.insert({0,0}); // A m2.insert({0,0}); m1.insert({1,0}); //T m2.insert({1,0}); m1.insert({2,0}); // C m2.insert({2,0}); ll cntr = 1; for(int i =x;i<=y;i++){ m1[s1[i]]++; m2[s2[i]]++; if(s1[i] != s2[i]) cntr++; } if(m1[0] != m2[0] || m1[1] != m2[1] || m1[2] != m2[2]) return -1; return cntr >> 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...