Submission #1009430

#TimeUsernameProblemLanguageResultExecution timeMemory
1009430somefjordMutating DNA (IOI21_dna)C++17
0 / 100
24 ms3672 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; string as, bs; vector<int> acount1, acount2, misplacecount; void init(string a, string b) { as = a; bs = b; int n = a.length(); acount1.resize(n + 2, 0); acount2.resize(n + 2, 0); misplacecount.resize(n + 2, 0); for (int i = 1; i <= n; ++i) { acount1[i] = acount1[i - 1] + (as[i - 1] == 'A'); acount2[i] = acount2[i - 1] + (bs[i - 1] == 'A'); misplacecount[i] = misplacecount[i - 1] + (as[i - 1] == 'A' && as[i - 1] != bs[i - 1]); // printf("i : %d, %d %d %d\n", i, acount1[i], acount2[i], // misplacecount[i]); } } int get_distance(int x, int y) { if ((acount1[y] - acount1[x]) != (acount2[y] - acount2[x])) return -1; return misplacecount[y] - misplacecount[x]; }
#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...