Submission #1009543

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