Submission #696198

#TimeUsernameProblemLanguageResultExecution timeMemory
696198hasanovrMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" #define ll long long #define sz1 5 #define sz2 100005 ll hsh[85], tbl[sz1][sz1][sz2], cnt[sz1][szs2], t[sz1][sz1]; void init(string a, string b){ hsh['A'] = 1; hsh['C'] = 2; hsh['T'] = 3; a = ' ' + a; b = ' ' + b; for(int i = 1; i < a.size(); i++){ cnt[hsh[a[i]]][i]++, cnt[hsh[b[i]]][i]--; for(int j = 1; j <= 3; j++){ cnt[j][i] += cnt[j][i - 1]; } for(int j = 1; j <= 3; j++){ for(int k = 1; k <= 3; k++){ tbl[j][k][i] = tbl[j][k][i - 1]; } } tbl[hsh[a[i]]][hsh[b[i]]][i]++; } } int get_distance(int x, int y){ x++, y++; for(int i = 1; i <= 3; i++){ if(cnt[i][y] != cnt[i][x - 1]){ return -1; } } for(int i = 1; i <= 3; i++){ for(int j = 1; j <= 3; j++){ t[i][j] = tbl[i][j][y] - tbl[i][j][x - 1]; } } long long ans = 0, tmp; tmp = min(t[1][2], t[2][1]); ans += tmp, t[1][2] -= tmp, t[2][1] -= tmp; tmp = min(t[1][3], t[3][1]); ans += tmp; tmp = min(t[2][3], t[3][2]); ans += tmp; return ans + (max(t[1][2], t[2][1])) * 2; }

Compilation message (stderr)

dna.cpp:5:42: error: 'szs2' was not declared in this scope; did you mean 'sz2'?
    5 | ll hsh[85], tbl[sz1][sz1][sz2], cnt[sz1][szs2], t[sz1][sz1];
      |                                          ^~~~
      |                                          sz2
dna.cpp:7:6: error: variable or field 'init' declared void
    7 | void init(string a, string b){
      |      ^~~~
dna.cpp:7:11: error: 'string' was not declared in this scope
    7 | void init(string a, string b){
      |           ^~~~~~
dna.cpp:7:11: note: suggested alternatives:
In file included from /usr/include/c++/10/string:39,
                 from dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note:   'std::string'
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/10/string:67:11: note:   'std::pmr::string'
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
dna.cpp:7:21: error: 'string' was not declared in this scope
    7 | void init(string a, string b){
      |                     ^~~~~~
dna.cpp:7:21: note: suggested alternatives:
In file included from /usr/include/c++/10/string:39,
                 from dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note:   'std::string'
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/10/string:67:11: note:   'std::pmr::string'
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:30:6: error: 'cnt' was not declared in this scope; did you mean 'int'?
   30 |   if(cnt[i][y] != cnt[i][x - 1]){
      |      ^~~
      |      int
dna.cpp:40:8: error: 'min' was not declared in this scope; did you mean 'std::min'?
   40 |  tmp = min(t[1][2], t[2][1]);
      |        ^~~
      |        std::min
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/string:40,
                 from dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: 'std::min' declared here
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
dna.cpp:46:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   46 |  return ans + (max(t[1][2], t[2][1])) * 2;
      |                ^~~
      |                std::max
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/string:40,
                 from dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: 'std::max' declared here
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~