# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097676 | Warinchai | Mutating DNA (IOI21_dna) | C++17 | 21 ms | 5916 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dna.h"
#include<bits/stdc++.h>
using namespace std;
long long vala[100005];
long long valb[100005];
long long same[100005];
int difA[100005];
int difC[100005];
int difT[100005];
long long md=1e9+7;
void init(std::string a, std::string b) {
long long ta=0,tb=0;
for(int i=0;i<a.size();i++){
vala[i+1]=((vala[i]*26)%md+a[i]-'A')%md;
valb[i+1]=((valb[i]*26)%md+b[i]-'A')%md;
same[i+1]=same[i];
if(a[i+1]==b[i+1])same[i+1]++;
}
}
int get_distance(int x, int y) {
x++,y++;
long long ta=(vala[y]+md-vala[x-1])%md;
long long tb=(valb[y]+md-valb[x-1])%md;
if(ta!=tb)return -1;
int val=y-x+1-same[y]-same[x-1];
return val/2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |