Submission #1215806

#TimeUsernameProblemLanguageResultExecution timeMemory
1215806GervidMutating DNA (IOI21_dna)C++20
Compilation error
0 ms0 KiB
#include "dna.h" vector<bool> va, vb; void init(std::string a, std::string b) { va.resize(a.size()); for (int i = 0; i < a.size(); i++) { if (a[i] == 'A') va[i] = 0; else va[i] = 1; } vb.resize(b.size()); for (int i = 0; i < b.size(); i++) { if (b[i] == 'A') vb[i] = 0; else vb[i] = 1; } } int get_distance(int x, int y) { int diff = 0; for (int i = x; i < y; i++) { if (va[i] != vb[i]) diff++; } return diff/2; }

Compilation message (stderr)

dna.cpp:3:1: error: 'vector' does not name a type
    3 | vector<bool> va, vb;
      | ^~~~~~
dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:6:9: error: 'va' was not declared in this scope; did you mean 'a'?
    6 |         va.resize(a.size());
      |         ^~
      |         a
dna.cpp:12:9: error: 'vb' was not declared in this scope; did you mean 'b'?
   12 |         vb.resize(b.size());
      |         ^~
      |         b
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:24:21: error: 'va' was not declared in this scope
   24 |                 if (va[i] != vb[i]) diff++;
      |                     ^~
dna.cpp:24:30: error: 'vb' was not declared in this scope
   24 |                 if (va[i] != vb[i]) diff++;
      |                              ^~