Submission #739594

#TimeUsernameProblemLanguageResultExecution timeMemory
739594Muaath_5Game (IOI13_game)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("Ofast,avx2") #include "game.h" #define ll long long #define OUT 0ll #define merge gcd2 using namespace std; const int N = (1<<30); struct ynode { ll val = OUT; ynode* left = nullptr, * right = nullptr; }; struct xnode { xnode* left = nullptr, * right = nullptr; ynode yy = ynode(); } *root; ll query_y(const int &qy1, const int &qy2, ynode* node, int l = 0, int r = N - 1) { if (node == nullptr || r < qy1 || qy2 < l) return OUT; if (qy1 <= l && r <= qy2) return node->val; const int mid = (l + r) / 2; return merge( query_y(qy1, qy2, node->left, l, mid), query_y(qy1, qy2, node->right, mid + 1, r) ); } ll query_x(const int &qx1, const int &qy1, const int &qx2, const int &qy2, xnode* node, int l = 0, int r = N - 1) { if (node == nullptr || r < qx1 || qx2 < l) return OUT; if (qx1 <= l && r <= qx2) return query_y(qy1, qy2, &node->yy); const int mid = (l + r) / 2; return merge( query_x(qx1, qy1, qx2, qy2, node->left, l, mid), query_x(qx1, qy1, qx2, qy2, node->right, mid + 1, r) ); } void update_y(const int &qy, const ll &val, ynode* node, int l = 0, int r = N - 1) { if (l == r) { node->val = val; return; } const int mid = (l + r) / 2; if (qy <= mid) { if (!node->left) node->left = new ynode(); update_y(qy, val, node->left, l, mid); } else { if (!node->right) node->right = new ynode(); update_y(qy, val, node->right, mid + 1, r); } node->val = merge((node->left ? node->left->val : OUT), (node->right ? node->right->val : OUT)); } void update_x(const int &qx, const int &qy, const ll &val, xnode* node, int l = 0, int r = N - 1) { if (node->yy) node->yy = ynode(); if (l == r) { update_y(qy, val, &node->yy); return; } const int mid = (l + r) / 2; if (qx <= mid) { if (!node->left) node->left = new xnode(); update_x(qx, qy, val, node->left, l, mid); } else { if (!node->right) node->right = new xnode(); update_x(qx, qy, val, node->right, mid + 1, r); } update_y(qy, merge( (node->left ? query_y(qy, qy, &node->left->yy) : OUT), (node->right ? query_y(qy, qy, &node->right->yy) : OUT) ), &node->yy); } void init(int R, int C) { root = new xnode(); } void update(int x, int y, long long k) { update_x(x, y, k, root); } long long calculate(int x1, int y1, int x2, int y2) { return query_x(x1, y1, x2, y2, root); }

Compilation message (stderr)

game.cpp:1:34: warning: bad option '-favx2' to pragma 'optimize' [-Wpragmas]
    1 | #pragma GCC optimize("Ofast,avx2")
      |                                  ^
In file included from game.cpp:2:
game.h:8:23: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
    8 | void init(int R, int C);
      |                       ^
game.h:8:23: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
game.h:9:38: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
    9 | void update(int P, int Q, long long K);
      |                                      ^
game.h:9:38: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
game.h:10:47: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   10 | long long calculate(int P, int Q, int U, int V);
      |                                               ^
game.h:10:47: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
game.cpp:20:81: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   20 | ll query_y(const int &qy1, const int &qy2, ynode* node, int l = 0, int r = N - 1)
      |                                                                                 ^
game.cpp: In function 'long long int query_y(const int&, const int&, ynode*, int, int)':
game.cpp:5:15: error: 'gcd2' was not declared in this scope
    5 | #define merge gcd2
      |               ^~~~
game.cpp:25:12: note: in expansion of macro 'merge'
   25 |     return merge(
      |            ^~~~~
game.cpp: At global scope:
game.cpp:31:113: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   31 | ll query_x(const int &qx1, const int &qy1, const int &qx2, const int &qy2, xnode* node, int l = 0, int r = N - 1)
      |                                                                                                                 ^
game.cpp: In function 'long long int query_x(const int&, const int&, const int&, const int&, xnode*, int, int)':
game.cpp:5:15: error: 'gcd2' was not declared in this scope
    5 | #define merge gcd2
      |               ^~~~
game.cpp:36:12: note: in expansion of macro 'merge'
   36 |     return merge(
      |            ^~~~~
game.cpp: At global scope:
game.cpp:43:82: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   43 | void update_y(const int &qy, const ll &val, ynode* node, int l = 0, int r = N - 1)
      |                                                                                  ^
game.cpp: In function 'void update_y(const int&, const long long int&, ynode*, int, int)':
game.cpp:5:15: error: 'gcd2' was not declared in this scope
    5 | #define merge gcd2
      |               ^~~~
game.cpp:58:17: note: in expansion of macro 'merge'
   58 |     node->val = merge((node->left ? node->left->val : OUT), (node->right ? node->right->val : OUT));
      |                 ^~~~~
game.cpp: At global scope:
game.cpp:61:97: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   61 | void update_x(const int &qx, const int &qy, const ll &val, xnode* node, int l = 0, int r = N - 1)
      |                                                                                                 ^
game.cpp: In function 'void update_x(const int&, const int&, const long long int&, xnode*, int, int)':
game.cpp:63:15: error: could not convert 'node->xnode::yy' from 'ynode' to 'bool'
   63 |     if (node->yy) node->yy = ynode();
      |         ~~~~~~^~
      |               |
      |               ynode
game.cpp:5:15: error: 'gcd2' was not declared in this scope
    5 | #define merge gcd2
      |               ^~~~
game.cpp:77:18: note: in expansion of macro 'merge'
   77 |     update_y(qy, merge(
      |                  ^~~~~
game.cpp: At global scope:
game.cpp:83:23: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   83 | void init(int R, int C) { root = new xnode(); }
      |                       ^
game.cpp:84:38: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   84 | void update(int x, int y, long long k) { update_x(x, y, k, root); }
      |                                      ^
game.cpp:85:51: warning: bad option '-favx2' to attribute 'optimize' [-Wattributes]
   85 | long long calculate(int x1, int y1, int x2, int y2) { return query_x(x1, y1, x2, y2, root); }
      |                                                   ^