Submission #1008012

#TimeUsernameProblemLanguageResultExecution timeMemory
1008012nisanduuMutating DNA (IOI21_dna)C++17
0 / 100
31 ms3924 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(s1!=s2){ return -1; } map<int,int> mp; for(ll i=x;i<=y;i++){ for(ll j=x;j<=y;j++){ if(st1[i]==st2[j]&&!mp[j]){ c += (i!=j); mp[j]++; } } } ll 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...