Submission #1081676

#TimeUsernameProblemLanguageResultExecution timeMemory
1081676raphael_heuchlMutating DNA (IOI21_dna)C++17
21 / 100
1592 ms3928 KiB
#include "dna.h" #include <iostream> std::string A, B; void init(std::string a, std::string b) { A = a; B = b; } int get_distance(int x, int y) { std::string a, b; for (int i = x; i <= y; ++i) a.push_back(A[i]), b.push_back(B[i]); if (a == b) return 0; for (int i = 0; i <= y - x; ++i) for (int j = i+1 ; j <= y - x; ++j) { std::swap(a[i], a[j]); if (a == b) return 1; std::swap(a[j], a[i]); } for (int i = 0; i <= y - x; ++i) for (int j = i + 1; j <= y - x; ++j) for (int l = 0; l <= y - x; ++l) for (int k = l+1; k <= y - x; ++k) { std::swap(a[i], a[j]); std::swap(a[l], a[k]); if (a == b) return 2; std::swap(a[k], a[l]); std::swap(a[j], a[i]); } return -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...