Submission #440781

#TimeUsernameProblemLanguageResultExecution timeMemory
440781jlozano254Mutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" #include <map> #include <vector> std::vector<std::map<char, int>> aDP; std::vector<std::map<char, int>> bDP; void init(std::string a, std::string b) { std::vector<std::map<char, int>> aux(a.length() + 1); aDP = aux; bDP = aux;    aDP[0]['A'] = 0;    aDP[0]['C'] = 0;    aDP[0]['T'] = 0;    bDP[0]['A'] = 0;    bDP[0]['C'] = 0;    bDP[0]['T'] = 0;    if (a[0] != b[0]) { aDP[1][a[0]]++; bDP[1][b[0]]++; } for (int i = 1; i < a.length(); ++i) { aDP[i + 1] = aDP[i]; bDP[i + 1] = bDP[i]; if (a[i] != b[i]) { aDP[i + 1][a[i]]++; bDP[i + 1][b[i]]++; } } } int get_distance(int x, int y) { y++; int aAcumA = aDP[y]['A'] - aDP[x]['A']; int aAcumC = aDP[y]['C'] - aDP[x]['C']; int aAcumT = aDP[y]['T'] - aDP[x]['T']; int bAcumA = bDP[y]['A'] - bDP[x]['A']; int bAcumC = bDP[y]['C'] - bDP[x]['C']; int bAcumT = bDP[y]['T'] - bDP[x]['T']; if (aAcumA != bAcumA || aAcumC != bAcumC || aAcumT != bAcumT) return -1;   int total = aAcumA + aAcumC + aAcumT;  int moves = total >> 1; return (total & 1) ? moves + 1 : moves; }

Compilation message (stderr)

dna.cpp:14:2: error: extended character   is not valid in an identifier
   14 |     aDP[0]['A'] = 0;
      |  ^
dna.cpp:14:5: error: extended character   is not valid in an identifier
   14 |     aDP[0]['A'] = 0;
      |    ^
dna.cpp:15:2: error: extended character   is not valid in an identifier
   15 |     aDP[0]['C'] = 0;
      |  ^
dna.cpp:15:5: error: extended character   is not valid in an identifier
   15 |     aDP[0]['C'] = 0;
      |    ^
dna.cpp:16:2: error: extended character   is not valid in an identifier
   16 |     aDP[0]['T'] = 0;
      |  ^
dna.cpp:16:5: error: extended character   is not valid in an identifier
   16 |     aDP[0]['T'] = 0;
      |    ^
dna.cpp:18:2: error: extended character   is not valid in an identifier
   18 |     bDP[0]['A'] = 0;
      |  ^
dna.cpp:18:5: error: extended character   is not valid in an identifier
   18 |     bDP[0]['A'] = 0;
      |    ^
dna.cpp:19:2: error: extended character   is not valid in an identifier
   19 |     bDP[0]['C'] = 0;
      |  ^
dna.cpp:19:5: error: extended character   is not valid in an identifier
   19 |     bDP[0]['C'] = 0;
      |    ^
dna.cpp:20:2: error: extended character   is not valid in an identifier
   20 |     bDP[0]['T'] = 0;
      |  ^
dna.cpp:20:5: error: extended character   is not valid in an identifier
   20 |     bDP[0]['T'] = 0;
      |    ^
dna.cpp:22:2: error: extended character   is not valid in an identifier
   22 |     if (a[0] != b[0]) {
      |  ^
dna.cpp:22:5: error: extended character   is not valid in an identifier
   22 |     if (a[0] != b[0]) {
      |    ^
dna.cpp:52:2: error: extended character   is not valid in an identifier
   52 |     int total = aAcumA + aAcumC + aAcumT;
      |  ^
dna.cpp:53:4: error: extended character   is not valid in an identifier
   53 |     int moves = total >> 1;
      |    ^
dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:14:2: error: '\U000000a0' was not declared in this scope
   14 |     aDP[0]['A'] = 0;
      |  ^
dna.cpp:15:4: error: expected ';' before '\U000000a0aDP'
   15 |     aDP[0]['C'] = 0;
      |   ^~~~~
      |   ;
dna.cpp:16:4: error: expected ';' before '\U000000a0aDP'
   16 |     aDP[0]['T'] = 0;
      |   ^~~~~
      |   ;
dna.cpp:18:4: error: expected ';' before '\U000000a0bDP'
   18 |     bDP[0]['A'] = 0;
      |   ^~~~~
      |   ;
dna.cpp:19:4: error: expected ';' before '\U000000a0bDP'
   19 |     bDP[0]['C'] = 0;
      |   ^~~~~
      |   ;
dna.cpp:20:4: error: expected ';' before '\U000000a0bDP'
   20 |     bDP[0]['T'] = 0;
      |   ^~~~~
      |   ;
dna.cpp:22:4: error: expected ';' before '\U000000a0if'
   22 |     if (a[0] != b[0]) {
      |   ^~~~
      |   ;
dna.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for (int i = 1; i < a.length(); ++i)
      |                  ~~^~~~~~~~~~~~
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:52:2: error: '\U000000a0' was not declared in this scope
   52 |     int total = aAcumA + aAcumC + aAcumT;
      |  ^
dna.cpp:53:4: error: '\U000000a0int' was not declared in this scope
   53 |     int moves = total >> 1;
      |    ^~~~
dna.cpp:55:10: error: 'total' was not declared in this scope
   55 |  return (total & 1) ? moves + 1 : moves;
      |          ^~~~~
dna.cpp:55:23: error: 'moves' was not declared in this scope
   55 |  return (total & 1) ? moves + 1 : moves;
      |                       ^~~~~