Submission #719216

#TimeUsernameProblemLanguageResultExecution timeMemory
719216mseebacherMutating DNA (IOI21_dna)C++17
0 / 100
33 ms2388 KiB
#include <bits/stdc++.h> using namespace std; string s1; string s2; void init(string x,string y){ s1 = x; s2 = y; } int get_distance(int x,int y){ int swaps = 0; for(int i = x;i<=y;i++){ int j = i+1; bool b = 0; if(s1[i] != s2[i]){ while(j <= y){ if(s1[j] == s2[i] && s1[j] != s2[j]){ swap(s1[j],s1[i]); swaps++; b = 1; break; } ++j; } if(!b) return -1; } } return swaps; }
#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...