Submission #657905

#TimeUsernameProblemLanguageResultExecution timeMemory
657905benjaminkleynMutating DNA (IOI21_dna)C++17
100 / 100
48 ms6168 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,fma,bmi,bmi2") #include <bits/stdc++.h> using namespace std; int n, pref[3][3][100001], cnt[3][3]; void init(string A, string B) { n = A.size(); for (int i = 0, a, b; i < n; i++) { for (a = 0; a < 3; a++) for (b = 0; b < 3; b++) pref[a][b][i + 1] = pref[a][b][i]; a = (A[i] == 'C') + 2 * (A[i] == 'T'); b = (B[i] == 'C') + 2 * (B[i] == 'T'); pref[a][b][i + 1]++; } } int get_distance(int x, int y) { for (int a = 0; a < 3; a++) for (int b = 0; b < 3; b++) cnt[a][b] = pref[a][b][y + 1] - pref[a][b][x]; for (int i = 0; i < 3; i++) if (cnt[i][0] + cnt[i][1] + cnt[i][2] != cnt[0][i] + cnt[1][i] + cnt[2][i]) return -1; return 2 * max(cnt[0][1], cnt[1][0]) - min(cnt[0][1], cnt[1][0]) + min(cnt[1][2], cnt[2][1]) + min(cnt[2][0], cnt[0][2]); }
#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...