# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
437200 | Bom164 | Mutating DNA (IOI21_dna) | C++17 | 41 ms | 3668 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<bits/stdc++.h>
#include<iostream>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define mod 1000000007
#define inf 1e18
#define w(x) int x; cin>>x; while(x--)
vector<int> as(111111);
vector<int> bs(111111);
vector<int> dif(111111);
string ad,bd;
void init(string a,string b){
int n=a.size();
ad=a;
bd=b;
for(int i=0;i<n;i++){
if(a[i]=='A'){
as[i]=0;
}else if(a[i]=='C'){
as[i]=1;
}else if(a[i]=='T'){
as[i]=2;
}
}
for(int i=0;i<n;i++){
if(b[i]=='A'){
bs[i]=0;
}else if(b[i]=='C'){
bs[i]=1;
}else if(b[i]=='T'){
bs[i]=2;
}
}
for(int i=1;i<=n-1;i++){
as[i]+=as[i-1];
bs[i]+=bs[i-1];
}
for(int i=0;i<n;i++){
if(a[i]!=b[i]){
dif[i]=1;
}
}
for(int i=1;i<=n-1;i++){
dif[i]+=dif[i-1];
}
}
int get_distance(int l,int r){
int ac=as[r]-(l==0?0:as[l-1]);
int bc=bs[r]-(l==0?0:bs[l-1]);
int c=0;
if(ac!=bc) return -1;
int cd=dif[r]-(l==0?0:dif[l-1]);
return cd;
}
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... |