Submission #522951

#TimeUsernameProblemLanguageResultExecution timeMemory
522951TurkhuuMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; vector<int> ax, at, ta, ct, aaa, bba, aac, bbc, aat, bbt; void init(std::string a, std::string b) { int n = (int)a.size(); ax.resize(n + 1); at.resize(n + 1); ta.resize(n + 1); ct.resize(n + 1); aaa.resize(n + 1); aac.resize(n + 1); aat.resize(n + 1); bba.resize(n + 1); bbc.resize(n + 1); bbt.resize(n + 1); for(int i = 0; i < n; i++){ ax[i + 1] = ax[i]; at[i + 1] = at[i]; ta[i + 1] = ta[i]; ct[i + 1] = ct[i]; aaa[i + 1] = aaa[i]; aac[i + 1] = aac[i]; aat[i + 1] = aat[i]; bba[i + 1] = bba[i]; bbc[i + 1] = bbc[i]; bbt[i + 1] = bbt[i]; if(a[i] == 'A'){ aaa[i + 1] += 1; } if(a[i] == 'C'){ aac[i + 1] += 1; } if(a[i] == 'T'){ aat[i + 1] += 1; } if(b[i] == 'A'){ bba[i + 1] += 1; } if(b[i] == 'C'){ bbc[i + 1] += 1; } if(b[i] == 'T'){ bbt[i + 1] += 1; } if(a[i] == 'A' && b[i] != 'A'){ ax[i + 1] += 1; } if(a[i] == 'A' && b[i] == 'T'){ at[i + 1] += 1; } if(a[i] == 'T' && b[i] == 'A'){ ta[i + 1] += 1; } if(a[i] == 'C' && b[i] == 'T'){ ct[i + 1] += 1; } if(a[i] == 'T' && b[i] == 'C'){ ct[i + 1] += 1; } } } int get_distance(int x, int y) { x += 1; y += 1; int AX = ax[y] - ax[x - 1]; int AT = at[y] - at[x - 1]; int TA = ta[y] - ta[x - 1]; int CT = ct[y] - ct[x - 1]; int AAA = aa[y] - aa[x - 1]; int AAC = ac[y] - ac[x - 1]; int AAT = at[y] - at[x - 1]; int BBA = ba[y] - ba[x - 1]; int BBC = bc[y] - bc[x - 1]; int BBT = bt[y] - bt[x - 1]; if(AAA != BBA || AAC != BBC || AAT != BBT){ return -1; } else{ return AX + (CT + abs(AT - TA)) / 2; } }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:74:12: error: 'aa' was not declared in this scope; did you mean 'aat'?
   74 |  int AAA = aa[y] - aa[x - 1];
      |            ^~
      |            aat
dna.cpp:75:12: error: 'ac' was not declared in this scope; did you mean 'aac'?
   75 |  int AAC = ac[y] - ac[x - 1];
      |            ^~
      |            aac
dna.cpp:77:12: error: 'ba' was not declared in this scope; did you mean 'bba'?
   77 |  int BBA = ba[y] - ba[x - 1];
      |            ^~
      |            bba
dna.cpp:78:12: error: 'bc' was not declared in this scope; did you mean 'bbc'?
   78 |  int BBC = bc[y] - bc[x - 1];
      |            ^~
      |            bbc
dna.cpp:79:12: error: 'bt' was not declared in this scope; did you mean 'bbt'?
   79 |  int BBT = bt[y] - bt[x - 1];
      |            ^~
      |            bbt