Submission #541292

#TimeUsernameProblemLanguageResultExecution timeMemory
541292AlesL0Mutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; long long n; vector <long long> a1, a2, t1, t2, c1, c2, f; void init(string a, string b){ n = a.size(); a1.resize(n+1); a2.resize(n+1); t1.resize(n+1); t2.resize(n+1); c1.resize(n+1); c2.resize(n+1); f.resize(n+1); a1[0] = 0; a2[0] = 0; t1[0] = 0; t2[0] = 0; c1[0] = 0; c2[0] = 0; f[0] = 0; for (long long i = 0; i < n; i++){ a1[i+1] = a1[i]; a2[i+1] = a2[i]; t1[i+1] = t1[i]; t2[i+1] = t2[i]; c1[i+1] = c1[i]; c2[i+1] = c2[i]; f[i+1] = f[i]; if (a[i] == 'A')a1[i+1]++; else if (a[i] == 'T')t1[i+1]++; else c1[i+1]++; if (b[i] == 'A')a2[i+1]++; else if (b[i] == 'T')t2[i+1]++; else c2[i+1]++; if (a[i] != b[i])f[i+1]++; } } int get_distance(long long x, long long y){ if (((a1[y+1]-a1[x])==(a2[y+1]-a2[x])) && ((t1[y+1]-t1[x])==(t2[y+1]-t2[x])) && ((c1[y+1]-c1[x])==(c2[y+1]-c2[x]))){ long long h = f[y+1]-f[x]; return ((h+h%2)/2); } else return -1; }

Compilation message (stderr)

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