Submission #552812

#TimeUsernameProblemLanguageResultExecution timeMemory
552812JomnoiMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; const int MAX_N = 1e5 + 10; int N; int preTA[MAX_N], preAA[MAX_N]; int preTB[MAX_N], preAB[MAX_N]; int preTA[MAX_N], preAT[MAX_N]; void init(string a, string b) { N = a.length(); for(int i = 1; i <= N; i++) { preTA[i] = preTA[i - 1] + (a[i - 1] == 'T'); preTB[i] = preTB[i - 1] + (b[i - 1] == 'T'); preAA[i] = preAA[i - 1] + (a[i - 1] == 'A'); preAB[i] = preAB[i - 1] + (b[i - 1] == 'A'); preTA[i] = preTA[i - 1] + (a[i - 1] == 'T' and b[i - 1] == 'A'); preAT[i] = preAT[i - 1] + (a[i - 1] == 'A' and b[i - 1] == 'T'); } } int range(int x, int y, int *a) { return a[y] - a[x - 1]; } int get_distance(int x, int y) { if(range(x, y, preTA) != range(x, y, preTB) or range(x, y, preAA) != range(x, y, preAB)) { return -1; } return min(range(x, y, preTA), range(x, y, preAT)); }

Compilation message (stderr)

dna.cpp:10:5: error: redefinition of 'int preTA [100010]'
   10 | int preTA[MAX_N], preAT[MAX_N];
      |     ^~~~~
dna.cpp:8:5: note: 'int preTA [100010]' previously declared here
    8 | int preTA[MAX_N], preAA[MAX_N];
      |     ^~~~~