Submission #1008022

#TimeUsernameProblemLanguageResultExecution timeMemory
1008022nisanduuMutating DNA (IOI21_dna)C++17
43 / 100
1578 ms11972 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; typedef long long ll; string st1,st2; void init(string a,string b){ st1=a; st2=b; } int get_distance(int x,int y){ multiset<char> s1,s2; int c = 0; for(ll i=x;i<=y;i++){ s1.insert(st1[i]); s2.insert(st2[i]); if(st1[i]!=st2[i]) c++; } if(s1!=s2){ return -1; } if(s1.size()==1) return 0; if(s1.size()==2){ if(st1[x]==st2[x]) return 0; return 1; } int ans = (c+1)/2; return ans; } // int main() // { // init("ATACAT", "ACTATA"); // cout<<get_distance(3, 5)<<endl; // return 0; // }
#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...