Submission #1081670

#TimeUsernameProblemLanguageResultExecution timeMemory
1081670raphael_heuchlMutating DNA (IOI21_dna)C++17
0 / 100
21 ms3924 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 = x; i <= y; ++i) for (int j = i+1 ; j <= y; ++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...