Submission #581641

#TimeUsernameProblemLanguageResultExecution timeMemory
581641penguinhackerMutating DNA (IOI21_dna)C++17
56 / 100
33 ms5404 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array const int mxN=1e5; int p[mxN+1][3], bad[mxN+1]; void init(string a, string b) { int n=a.size(); for (int i=0; i<n; ++i) { p[i+1][0]=p[i][0]+(a[i]=='A')-(b[i]=='A'); p[i+1][1]=p[i][1]+(a[i]=='T')-(b[i]=='T'); p[i+1][2]=p[i][2]+(a[i]=='C')-(b[i]=='C'); bad[i+1]=bad[i]+(a[i]!=b[i]); } } int get_distance(int x, int y) { for (int i=0; i<3; ++i) if (p[y+1][i]-p[x][i]) return -1; return (bad[y+1]-bad[x]+1)/2; } /*int main() { ios::sync_with_stdio(0); cin.tie(0); init("ATACAT", "ACTATA"); cout << get_distance(1, 3) << " " << get_distance(4, 5) << " " << get_distance(3, 5); return 0; }*/
#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...