Submission #965507

# Submission time Handle Problem Language Result Execution time Memory
965507 2024-04-18T18:37:30 Z marinaluca Mutating DNA (IOI21_dna) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")

using namespace std;
#define int long long
#define ll long long
#define xx first
#define yy second

const int NMAX = 1e5;
int at[NMAX + 5], t[NMAX + 5], c[NMAX + 5];
int v[NMAX + 5];

string a, b;
void init (string as, string bs){
    int n = as.length();
    a = as;
    b = bs;
    for (int i = 1; i <= n; ++ i){
        at[i] = at[i - 1];
        t[i] = t[i - 1];
        c[i] = c[i - 1];
        v[i] = v[i - 1];
        if (a[i - 1] == b[i - 1])
            v[i] ++;
        else if (a[i - 1] == 'A' && b[i - 1] == 'T')
            at[i] ++;
        else if (a[i - 1] == 'T' && b[i - 1] == 'A')
            at[i] --;
        else if (a[i - 1] == 'T' && b[i - 1] == 'C')
            t[i] ++;
        else if (a[i - 1] == 'C' && b[i - 1] == 'T')
            t[i] --;
        else if (a[i - 1] == 'C' && b[i - 1] == 'A')
            c[i] ++;
        else
            c[i] --;
    }
}

int get_distance(int x, int y){
    y ++;
    int unu = at[y] - at[x];
    int doi = t[y] - t[x];
    int trei = c[y] - c[x];
    if (unu != doi || unu != trei)
        return -1;
    int val = abs (unu) * 2;
    int ans = y - x;
    ans -= (v[y] - v[x]);
    ans -= abs(unu) * 3;
    ans += val / 2;
    return ans;
}

Compilation message

/usr/bin/ld: /tmp/cclqezaS.o: in function `main':
grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status