Submission #524662

#TimeUsernameProblemLanguageResultExecution timeMemory
524662LoboMutating DNA (IOI21_dna)C++17
0 / 100
31 ms6564 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; const long long inf = (long long) 1e18 + 10; const int inf1 = (int) 1e9 + 10; // #define int long long #define dbl long double #define endl '\n' #define sc second #define fr first #define mp make_pair #define pb push_back #define all(x) x.begin(), x.end() #define maxn 110000 int v1[maxn], v2[maxn], qtd1[3][maxn], qtd2[3][maxn], ans[maxn]; int get_distance(int x, int y) { int l = x+1; int r = y+1; if(qtd1[0][r]-qtd1[0][l-1] != qtd2[0][r]-qtd2[0][l-1] || qtd1[1][r]-qtd1[1][l-1] != qtd2[1][r]-qtd2[1][l-1] || qtd1[2][r]-qtd1[2][l-1] != qtd2[2][r]-qtd2[2][l-1]) { return -1; } return (ans[r]-ans[l-1])/2; } void init(string a, string b) { int n = a.size(); for(int i = 1; i <= n; i++) { if(a[i] == 'A') v1[i] = 0; if(a[i] == 'T') v1[i] = 1; if(a[i] == 'C') v1[i] = 2; qtd1[0][i] = qtd1[0][i-1]; qtd1[1][i] = qtd1[1][i-1]; qtd1[2][i] = qtd1[2][i-1]; qtd1[v1[i]][i]++; } for(int i = 1; i <= n; i++) { if(b[i] == 'A') v2[i] = 0; if(b[i] == 'T') v2[i] = 1; if(b[i] == 'C') v2[i] = 2; qtd2[0][i] = qtd2[0][i-1]; qtd2[1][i] = qtd2[1][i-1]; qtd2[2][i] = qtd2[2][i-1]; qtd2[v2[i]][i]++; } for(int i = 1; i <= n; i++) { ans[i] = ans[i-1]; if(v1[i] != v2[i]) ans[i]++; } }
#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...