Submission #565961

#TimeUsernameProblemLanguageResultExecution timeMemory
565961FairyWinxMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" #include <vector> #include <array> #define all(a) a.begin(), a.end(); using namespace std; vector<int> a, b; void init(std::string _a, std::string _b) { a.resize(_a.size()); b.resize(_b.size()); for (int i = 0; i < (int) _a.size(); ++i) { if (_a[i] == 'A') { a[i] = 0; } else if (_a[i] == 'T') { a[i] = 1; } else { a[i] = 2; } if (_b[i] == 'A') { b[i] = 0; } else if (_b[i] == 'T') { b[i] = 1; } else { b[i] = 2; } } } int get_distance(int x, int y) { array<int, 3> c1, c2; int sum = 0; fill(all(c1), 0); fill(all(c2), 0); for (int i = x; i <= y; ++i) { if (a[i] != b[i]) { ++c1[a[i]]; ++c2[b[i]]; ++sum; } } if (c1 != c2) { return -1; } else { return max(*max_element(all(c1)), (sum + 1) / 2); } return 0; }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:5:34: error: expected ')' before ';' token
    5 | #define all(a) a.begin(), a.end();
      |                                  ^
dna.cpp:35:7: note: in expansion of macro 'all'
   35 |  fill(all(c1), 0);
      |       ^~~
dna.cpp:35:6: note: to match this '('
   35 |  fill(all(c1), 0);
      |      ^
dna.cpp:35:14: error: expected primary-expression before ',' token
   35 |  fill(all(c1), 0);
      |              ^
dna.cpp:5:34: error: expected ')' before ';' token
    5 | #define all(a) a.begin(), a.end();
      |                                  ^
dna.cpp:36:7: note: in expansion of macro 'all'
   36 |  fill(all(c2), 0);
      |       ^~~
dna.cpp:36:6: note: to match this '('
   36 |  fill(all(c2), 0);
      |      ^
dna.cpp:36:14: error: expected primary-expression before ',' token
   36 |  fill(all(c2), 0);
      |              ^
dna.cpp:5:34: error: expected ')' before ';' token
    5 | #define all(a) a.begin(), a.end();
      |                                  ^
dna.cpp:47:27: note: in expansion of macro 'all'
   47 |   return max(*max_element(all(c1)), (sum + 1) / 2);
      |                           ^~~
dna.cpp:47:26: note: to match this '('
   47 |   return max(*max_element(all(c1)), (sum + 1) / 2);
      |                          ^
dna.cpp:47:34: error: expected primary-expression before ')' token
   47 |   return max(*max_element(all(c1)), (sum + 1) / 2);
      |                                  ^