| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 437916 | Haidara | DNA 돌연변이 (IOI21_dna) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* * * * * * * * * *
* ID: Haidara *
* LANG: C++17 *
* PROB: *
* * * * * * * * * */
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define rep(i,x,n) for(int i=x;i<n;i++)
#define FOR(i,n) rep(i,0,n)
#define per(i,x,n) for(int i=x;i>n;i--)
#define ROF(i,x) for(int i=x;i>=0;i--)
#define v(i) vector< i >
#define p(i,j) pair< i , j >
#define pii pair<int,int>
#define m(i,j) map< i , j >
#define pq(i) priority_queue< i >
#define ff first
#define all(x) x.begin(),x.end()
#define ss second
#define pp push_back
using namespace std;
void SIO(string name="")
{
if(name!="")
{
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
}
const int inf=1LL<<62LL;
const int mod=1e9+7;
const int maxn=100100;
int At[maxn],ta[maxn],tc[maxn],ct[maxn],ac[maxn],ca[maxn];
void init(string a, string b)
{
FOR(i,a.size())
{
At[i+1]=At[i];
ta[i+1]=ta[i];
tc[i+1]=tc[i];
ct[i+1]=ct[i];
ac[i+1]=ac[i];
ca[i+1]=ca[i];
if(a[i]=='A')
{
if(b[i]=='T')
At[i+1]++;
else if(b[i]=='C')
ac[i+1]++;
}
else if(a[i]=='T')
{
if(b[i]=='A')
ta[i+1]++;
else if(b[i]=='C')
tc[i+1]++;
}
else if(a[i]=='C')
{
if(b[i]=='A')
ca[i+1]++;
else if(b[i]=='T')
ct[i+1]++;
}
}
return ;
}
int get_distance(int x, int y)
{
y++;
int ans=0;
ans+=min(At[y]-At[x],ta[y]-ta[x]);
ans+=abs(At[y]-At[x]-ta[y]+ta[x]);
ans+=min(tc[y]-tc[x],ct[y]-ct[x]);
ans+=abs(tc[y]-tc[x]-ct[y]+ct[x]);
ans+=min(ac[y]-ac[x],ca[y]-ca[x]);
ans+=abs(ac[y]-ac[x]-ca[y]+ca[x]);
cout<<ans-1;
}
