Submission #720838

#TimeUsernameProblemLanguageResultExecution timeMemory
720838uroskMutating DNA (IOI21_dna)C++17
0 / 100
38 ms14540 KiB
#include "dna.h"
#include <bits/stdc++.h>
#define ll long long

using namespace std;
#define maxn 100005
ll n;
ll ps[maxn][4][4];
map<char,ll> mp;
void init(std::string a, std::string b) {
    mp['A'] = 1;
    mp['T'] = 2;
    mp['C'] = 3;
    n = a.size();
    for(ll i = 1;i<=n;i++){
       ll ca = mp[a[i-1]];
       ll cb = mp[b[i-1]];
       for(ll j = 1;j<=3;j++){
            for(ll k = 1;k<=3;k++){
                ps[i][j][k] = ps[i-1][j][k];
            }
       }
       ps[i][ca][cb]++;
    }
}
ll f[4][4];
int get_distance(int x, int y) {
    x++; y++;
    for(ll i = 1;i<=3;i++) for(ll j = 1;j<=3;j++) f[i][j] = ps[y][i][j] - ps[x][i][j];
    if(f[1][2]!=f[2][1]) return -1;
	return f[1][2];
}
/**
6 3
ATACAT ACTATA
1 3
4 5
3 5
**/
#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...