Submission #714531

#TimeUsernameProblemLanguageResultExecution timeMemory
714531mseebacherMutating DNA (IOI21_dna)C++17
35 / 100
44 ms5000 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; #define MAXI (int)1e5 #define pb(x) push_back(x) int s1A[(int)1e5+5]; int s2A[(int)1e5+5]; int falsch[(int)1e5+5]; void init(string x,string y){ s1A[0] = 0; s2A[0] = falsch[0] = 0 ; int n = x.length(); for(int i = 0;i<n;i++){ s1A[i+1] = s1A[i]; s2A[i+1] = s2A[i]; falsch[i+1] = falsch[i]; if(x[i] == 'A') s1A[i+1]++; if(y[i] == 'A') s2A[i+1]++; if(x[i] != y[i]) falsch[i+1]++; } } int get_distance(int x,int y){ ++x; ++y; if(s1A[y]-s1A[x-1] != s2A[y]-s2A[x-1]) return -1; return (falsch[y]-falsch[x-1]+1) >> 1; }
#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...