Submission #1228322

#TimeUsernameProblemLanguageResultExecution timeMemory
1228322bornagMutating DNA (IOI21_dna)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; #define pb push_back #define eb emplace_back #define upb upper_bound #define lpb lower_bound #define ppb pop_back #define X first #define Y second #define all(a) a.begin(), a.end() #define len(a) (int) (a.size()) const ll MOD = 1e9 + 7; const ll BASE = 32; const int MAXN = 1e5 + 7; int pref[MAXN][7][10]; int same[MAXN]; void init(string a, string b) { for(int i = 0; i < len(a); i++) { for(int j = 0; j < 2; j++) for(int k = 0; k < 3; k++) pref[i + 1][j][k] += pref[i][j][k]; pref[i + 1][1][(b[i] == 'A' ? 0 : (b[i] == 'C' ? 1 : 2))]++; pref[i + 1][0][(a[i] == 'A' ? 0 : (a[i] == 'C' ? 1 : 2))]++; same[i + 1] = same[i] + !(a[i] == b[i]); } } int get_distance(int x, int y) { x++, y++; if(pref[y][1][0] - pref[x - 1][1][0] != pref[y][0][0] - pref[x - 1][0][0] || pref[y][1][1] - pref[x - 1][1][1] != pref[y][0][1] - pref[x - 1][0][1] || pref[y][1][2] - pref[x - 1][1][2] != pref[y][0][2] - pref[x - 1][0][2]) return -1; return (same[y] - same[x - 1]) / 2 + ((same[y] - same[x - 1]) % 2); }

Compilation message (stderr)

dna.cpp:4:18: error: wrong number of template arguments (1, should be 2)
    4 | #define int long long;
      |                  ^~~~
dna.cpp:5:14: note: in expansion of macro 'int'
    5 | typedef pair<int, int> pii;
      |              ^~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from dna.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
  211 |     struct pair
      |            ^~~~
dna.cpp:5:1: warning: 'typedef' was ignored in this declaration
    5 | typedef pair<int, int> pii;
      | ^~~~~~~
dna.cpp:5:17: error: expected unqualified-id before ',' token
    5 | typedef pair<int, int> pii;
      |                 ^
dna.cpp:4:13: error: expected unqualified-id before 'long'
    4 | #define int long long;
      |             ^~~~
dna.cpp:5:19: note: in expansion of macro 'int'
    5 | typedef pair<int, int> pii;
      |                   ^~~
dna.cpp:5:22: error: expected unqualified-id before '>' token
    5 | typedef pair<int, int> pii;
      |                      ^
dna.cpp:6:14: error: 'll' was not declared in this scope; did you mean 'all'?
    6 | typedef pair<ll, ll> pll;
      |              ^~
      |              all
dna.cpp:6:18: error: 'll' was not declared in this scope; did you mean 'all'?
    6 | typedef pair<ll, ll> pll;
      |                  ^~
      |                  all
dna.cpp:6:20: error: template argument 1 is invalid
    6 | typedef pair<ll, ll> pll;
      |                    ^
dna.cpp:6:20: error: template argument 2 is invalid
dna.cpp:4:18: error: template argument 1 is invalid
    4 | #define int long long;
      |                  ^~~~
dna.cpp:7:16: note: in expansion of macro 'int'
    7 | typedef vector<int> vii;
      |                ^~~
dna.cpp:4:18: error: template argument 2 is invalid
    4 | #define int long long;
      |                  ^~~~
dna.cpp:7:16: note: in expansion of macro 'int'
    7 | typedef vector<int> vii;
      |                ^~~
dna.cpp:7:1: warning: 'typedef' was ignored in this declaration
    7 | typedef vector<int> vii;
      | ^~~~~~~
dna.cpp:7:19: error: expected unqualified-id before '>' token
    7 | typedef vector<int> vii;
      |                   ^
dna.cpp:8:16: error: 'll' was not declared in this scope; did you mean 'pll'?
    8 | typedef vector<ll> vll;
      |                ^~
      |                pll
dna.cpp:8:18: error: template argument 1 is invalid
    8 | typedef vector<ll> vll;
      |                  ^
dna.cpp:8:18: error: template argument 2 is invalid
dna.cpp:9:16: error: 'pii' was not declared in this scope
    9 | typedef vector<pii> vpii;
      |                ^~~
dna.cpp:9:19: error: template argument 1 is invalid
    9 | typedef vector<pii> vpii;
      |                   ^
dna.cpp:9:19: error: template argument 2 is invalid
dna.cpp:22:7: error: 'll' does not name a type; did you mean 'vll'?
   22 | const ll MOD = 1e9 + 7;
      |       ^~
      |       vll
dna.cpp:23:7: error: 'll' does not name a type; did you mean 'vll'?
   23 | const ll BASE = 32;
      |       ^~
      |       vll
dna.cpp:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
dna.cpp:24:7: note: in expansion of macro 'int'
   24 | const int MAXN = 1e5 + 7;
      |       ^~~
dna.cpp:24:11: error: 'MAXN' does not name a type
   24 | const int MAXN = 1e5 + 7;
      |           ^~~~
dna.cpp:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
dna.cpp:26:1: note: in expansion of macro 'int'
   26 | int pref[MAXN][7][10];
      | ^~~
dna.cpp:26:5: error: 'pref' does not name a type
   26 | int pref[MAXN][7][10];
      |     ^~~~
dna.cpp:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
dna.cpp:27:1: note: in expansion of macro 'int'
   27 | int same[MAXN];
      | ^~~
dna.cpp:27:5: error: 'same' does not name a type
   27 | int same[MAXN];
      |     ^~~~
dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
dna.cpp:31:13: note: in expansion of macro 'int'
   31 |         for(int i = 0; i < len(a); i++) {
      |             ^~~
dna.cpp:31:17: error: 'i' was not declared in this scope
   31 |         for(int i = 0; i < len(a); i++) {
      |                 ^
dna.cpp:4:13: error: expected primary-expression before 'long'
    4 | #define int long long;
      |             ^~~~
dna.cpp:20:17: note: in expansion of macro 'int'
   20 | #define len(a) (int) (a.size())
      |                 ^~~
dna.cpp:31:28: note: in expansion of macro 'len'
   31 |         for(int i = 0; i < len(a); i++) {
      |                            ^~~
dna.cpp:4:13: error: expected ')' before 'long'
    4 | #define int long long;
      |             ^~~~
dna.cpp:20:17: note: in expansion of macro 'int'
   20 | #define len(a) (int) (a.size())
      |                 ^~~
dna.cpp:31:28: note: in expansion of macro 'len'
   31 |         for(int i = 0; i < len(a); i++) {
      |                            ^~~
dna.cpp:20:16: note: to match this '('
   20 | #define len(a) (int) (a.size())
      |                ^
dna.cpp:31:28: note: in expansion of macro 'len'
   31 |         for(int i = 0; i < len(a); i++) {
      |                            ^~~
dna.cpp:4:22: error: expected ')' before ';' token
    4 | #define int long long;
      |                      ^
dna.cpp:20:17: note: in expansion of macro 'int'
   20 | #define len(a) (int) (a.size())
      |                 ^~~
dna.cpp:31:28: note: in expansion of macro 'len'
   31 |         for(int i = 0; i < len(a); i++) {
      |                            ^~~
dna.cpp:31:12: note: to match this '('
   31 |         for(int i = 0; i < len(a); i++) {
      |            ^
dna.cpp:20:20: error: expected primary-expression before ')' token
   20 | #define len(a) (int) (a.size())
      |                    ^
dna.cpp:31:28: note: in expansion of macro 'len'
   31 |         for(int i = 0; i < len(a); i++) {
      |                            ^~~
dna.cpp:31:36: error: 'i' was not declared in this scope
   31 |         for(int i = 0; i < len(a); i++) {
      |                                    ^
dna.cpp: At global scope:
dna.cpp:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
dna.cpp:42:1: note: in expansion of macro 'int'
   42 | int get_distance(int x, int y) {
      | ^~~
dna.cpp:4:22: error: expected ')' before ';' token
    4 | #define int long long;
      |                      ^
dna.cpp:42:18: note: in expansion of macro 'int'
   42 | int get_distance(int x, int y) {
      |                  ^~~
dna.cpp:42:17: note: to match this '('
   42 | int get_distance(int x, int y) {
      |                 ^
dna.cpp:4:22: error: expected constructor, destructor, or type conversion before ';' token
    4 | #define int long long;
      |                      ^
dna.cpp:42:18: note: in expansion of macro 'int'
   42 | int get_distance(int x, int y) {
      |                  ^~~
dna.cpp:42:22: error: 'x' does not name a type
   42 | int get_distance(int x, int y) {
      |                      ^
dna.cpp:42:29: error: 'y' does not name a type
   42 | int get_distance(int x, int y) {
      |                             ^