Submission #499676

#TimeUsernameProblemLanguageResultExecution timeMemory
499676sazid_alamMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" using namespace std; void init(string a, string b) { } int get_distance(int x, int y) { int p = 0, A[2] = {}, C[2] = {}, T[2] = {}; for(int i = 0; i < a.size(); i++){ if(a[i] != b[i]) p++; if(a[i] == 'A') A[0]++; if(b[i] == 'A') A[1]++; if(a[i] == 'C') C[0]++; if(b[i] == 'C') C[1]++; if(a[i] == 'T') T[0]++; if(b[i] == 'T') T[1]++; } if(A[0] != A[1] || C[0] != C[1] || T[0] != T[1]) return -1; if(p % 2) return p / 2 + 1; else return p / 2; return 0; }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:10:24: error: 'a' was not declared in this scope
   10 |     for(int i = 0; i < a.size(); i++){
      |                        ^
dna.cpp:11:20: error: 'b' was not declared in this scope
   11 |         if(a[i] != b[i]) p++;
      |                    ^
dna.cpp:13:12: error: 'b' was not declared in this scope
   13 |         if(b[i] == 'A') A[1]++;
      |            ^
dna.cpp:15:12: error: 'b' was not declared in this scope
   15 |         if(b[i] == 'C') C[1]++;
      |            ^
dna.cpp:17:12: error: 'b' was not declared in this scope
   17 |         if(b[i] == 'T') T[1]++;
      |            ^