제출 #900832

#제출 시각아이디문제언어결과실행 시간메모리
900832trMatherz게임 (IOI13_game)C++17
컴파일 에러
0 ms0 KiB
//#include <iostream> //cin, cout //#include "game.h" /* #include <fstream> std::ifstream cin ("ex.in"); std::ofstream cout ("ex.out"); */ // includes #include <cmath> #include <set> #include <map> #include <queue> #include <string> #include <vector> #include <array> #include <algorithm> #include <numeric> #include <iomanip> #include <unordered_set> #include <stack> #include <ext/pb_ds/assoc_container.hpp> #include <random> #include <chrono> //usings using namespace std; using namespace __gnu_pbds; // misc #define ll long long #define pb push_back #define pq priority_queue #define ub upper_bound #define lb lower_bound template<typename T, typename U> bool emin(T &a, const U &b){ return b < a ? a = b, true : false; } template<typename T, typename U> bool emax(T &a, const U &b){ return b > a ? a = b, true : false; } typedef uint64_t hash_t; // vectors #define vi vector<int> #define vvi vector<vi> #define vvvi vector<vvi> #define vpii vector<pair<int, int>> #define vvpii vector<vector<pair<int, int>>> #define vppipi vector<pair<int, pair<int, int>>> #define vl vector<ll> #define vvl vector<vl> #define vvvl vector<vvl> #define vpll vector<pair<ll, ll>> #define vb vector<bool> #define vvb vector<vb> #define vs vector<string> #define sz(x) (int)x.size() #define rz resize #define all(x) x.begin(), x.end() // pairs #define pii pair<int, int> #define pll pair<ll, ll> #define mp make_pair #define f first #define s second // sets #define si set<int> #define sl set<ll> #define ss set<string> #define in insert template <class T> using iset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // maps #define mii map<int, int> #define mll map<ll, ll> // loops #define FR(x, z, y) for (int x = z; x < y; x++) #define FRe(x, z, y) FR(x, z, y + 1) #define F(x, y) FR(x, 0, y) #define Fe(x, y) F(x, y + 1) #define A(x, y) for(auto &x : y) int Y, X; struct Xnode{ ll v; int l, r; Xnode *lc, *rc; Xnode(int x, int y) : l(x), r(y), v(0), lc(NULL), rc(NULL) {} }; struct Ynode{ Xnode *node; Ynode *lc, *rc; Ynode() : lc(NULL), rc(NULL), node(NULL) {} } *root; ll gcd2(ll x, ll y){ if(y == 0) return x; return gcd2(y, x % y); } void upd2(Xnode *cur, int x, ll v){ int l = cur->l, r = cur->r, m = (r + l) / 2; if(l == r){ cur->v = v; return; } if(x <= m){ if(!cur->lc) cur->lc = new Xnode(l, m); upd2(cur->lc, x, v); } else { if(!cur->rc) cur->rc = new Xnode(m + 1, r); upd2(cur->rc, x, v); } } void upd1(Ynode *cur, int l, int r, int y, int x, ll v){ if(l == r) {upd2(cur->node, x, v); return;} int m = (r + l) / 2; if(y <= m){ if(!cur->lc) cur->lc = new Ynode; upd1(cur->lc, l, m, y, x, v); } else { if(!cur->rc) cur->rc = new Ynode; upd1(cur->rc, m + 1, r, y, x, v); } } ll get2(Xnode *cur, int rl, int rr){ if(cur == NULL || cur->r < rl || cur->l > rr) return 0; if(rl <= cur->l && cur->r <= rr) return cur->v; return gcd2(get2(cur->lc, rl, rr), get2(cur->rc, rl, rr)); } ll get1(Ynode *cur, int l, int r, int rl, int rr, int xl, int xr){ if(cur == NULL || l > rr || r < rl) return 0; if(rl <= l && rr <= rr) return get2(cur->node, xl, xr); int m = (r + l) / 2; return gcd(get1(cur->lc, l, m, rl, rr, xl, xr), get1(cur->rc, m + 1, r, rl, rr, xl, xr)); } void init(int R, int C){ Y = R, X = C; root = new Ynode; } void update(int P, int Q, ll K){ P++; Q++; upd1(root, 1, Y, P, Q, K); } ll calculate(int P, int Q, int U, int V){ P++; Q++; U++; V++; return get1(root, 1, Y, P, U, Q, V); }

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In constructor 'Xnode::Xnode(int, int)':
game.cpp:93:9: warning: 'Xnode::r' will be initialized after [-Wreorder]
   93 |  int l, r;
      |         ^
game.cpp:92:5: warning:   'long long int Xnode::v' [-Wreorder]
   92 |  ll v;
      |     ^
game.cpp:95:2: warning:   when initialized here [-Wreorder]
   95 |  Xnode(int x, int y) : l(x), r(y), v(0), lc(NULL), rc(NULL) {}
      |  ^~~~~
game.cpp: In constructor 'Ynode::Ynode()':
game.cpp:100:14: warning: 'Ynode::rc' will be initialized after [-Wreorder]
  100 |  Ynode *lc, *rc;
      |              ^~
game.cpp:99:9: warning:   'Xnode* Ynode::node' [-Wreorder]
   99 |  Xnode *node;
      |         ^~~~
game.cpp:101:2: warning:   when initialized here [-Wreorder]
  101 |  Ynode() : lc(NULL), rc(NULL), node(NULL) {}
      |  ^~~~~
game.cpp: In function 'long long int get1(Ynode*, int, int, int, int, int, int)':
game.cpp:147:19: warning: self-comparison always evaluates to true [-Wtautological-compare]
  147 |  if(rl <= l && rr <= rr) return get2(cur->node, xl, xr);
      |                ~~ ^~ ~~
/usr/bin/ld: /tmp/ccHub5Fl.o: in function `main':
grader.c:(.text.startup+0x6b): undefined reference to `init'
/usr/bin/ld: grader.c:(.text.startup+0xd0): undefined reference to `calculate'
/usr/bin/ld: grader.c:(.text.startup+0x13e): undefined reference to `update'
collect2: error: ld returned 1 exit status