This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Editor: Abdelrahman Hossam
Nickname: Blobo2_Blobo2
IOI next year isA :)
*/
/*#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loop")*/
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define endl "\n"
#define all(v) v.begin(),v.end()
#define gen(arr,n,nxt) generate(arr,arr+n,nxt)
#define Blobo2 ios_base::sync_with_stdio(false);cin.tie(0);
const int mo=998244353;
int A1[100001],C1[100001],T1[100001];
int A2[100001],C2[100001],T2[100001];
int ac[100001],at[100001],ct[100001];
int ca[100001],ta[100001],tc[100001];
int arr[100001];
void init(string a,string b){
for(int i=0;i<(int)a.size();i++){
A1[i+1] = A1[i] + (a[i] == 'A');
C1[i+1] = C1[i] + (a[i] == 'C');
T1[i+1] = T1[i] + (a[i] == 'T');
A2[i+1] = A2[i] + (b[i] == 'A');
C2[i+1] = C2[i] + (b[i] == 'C');
T2[i+1] = T2[i] + (b[i] == 'T');
ac[i+1] = ac[i] + (a[i] == 'A' && b[i] == 'C');
at[i+1] = at[i] + (a[i] == 'A' && b[i] == 'T');
ct[i+1] = ct[i] + (a[i] == 'C' && b[i] == 'T');
ca[i+1] = ca[i] + (a[i] == 'C' && b[i] == 'A');
ta[i+1] = ta[i] + (a[i] == 'T' && b[i] == 'A');
tc[i+1] = tc[i] + (a[i] == 'T' && b[i] == 'C');
//cout<<ac[i+1]<<' '<<at[i+1]<<' '<<ct[i+1]<<' '<<ca[i+1]<<' '<<ta[i+1]<<' '<<tc[i+1]<<endl;
}
}
int get_distance(int x,int y){
if(A1[y+1]-A1[x] == A2[y+1]-A2[x] &&
C1[y+1]-C1[x] == C2[y+1]-C2[x] &&
T1[y+1]-T1[x] == T2[y+1]-T2[x]){
int cnt=0;
int AC = (ac[y+1] - ac[x]), CA = (ca[y+1] - ca[x]);
int tmb1 = abs(AC-CA);
int AT = (at[y+1] - at[x]), TA = (ta[y+1] - ta[x]);
int TC = (tc[y+1] - tc[x]), CT = (ct[y+1] - ct[x]);
cnt += min(AC,CA);
cnt += min(AT,TA);
cnt += min(TC,CT);
cnt += tmb1*2;
return cnt;
}
return -1;
}
# | 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... |