Submission #1149844

#TimeUsernameProblemLanguageResultExecution timeMemory
1149844SalihSahin게임 (IOI13_game)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define pb push_back #include "game.h" #define int long long using namespace std; const int inf = 1e9; const int N = 1e9 + 5; long long gcd2(long long X, long long Y) { long long tmp; while (X != Y && Y != 0) { tmp = X; X = Y; Y = tmp % Y; } return X; } struct node{ node *lc, *rc; int gcd; node(){ gcd = 0; lc = rc = nullptr; } }; struct node1{ node1 *lc, *rc; node *in; node1(){ lc = rc = nullptr; in = nullptr; } }; node1 *kok; void updateY(node *root, int l, int r, int y, int val){ if(l == r){ root->gcd = val; } else{ int m = (l + r)/2; if(root->lc == nullptr){ root->lc = new node(); } if(root->rc == nullptr){ root->rc = new node(); } if(y <= m) updateY(root->lc, l, m, y, val); else updateY(root->rc, m+1, r, y, val); root->gcd = __gcd(root->lc->gcd, root->rc->gcd); } } void updateX(node1 *root, int l, int r, int x, int y, int val){ if(l == r){ if(root->in == nullptr){ root->in = new node(); } updateY(root->in, 1, N, y, val); } else{ int m = (l + r)/2; if(root->lc == nullptr){ root->lc = new node1(); } if(root->rc == nullptr){ root->rc = new node1(); } if(x <= m) updateX(root->lc, l, m, x, y, val); else updateX(root->rc, m+1, r, x, y, val); updateY(root->in, 1, N, y, val); } } int queryX(node *root, int l, int r, int ql, int qr){ if(l > r || ql > qr || l > qr || r < ql) return 0; if(l >= ql && r <= qr){ return root->gcd; } else{ int m = (l + r)/2; if(root->lc == nullptr){ root->lc = new node(); } if(root->rc == nullptr){ root->rc = new node(); } return __gcd(queryX(root->lc, l, m, ql, qr), queryX(root->rc, m+1, r, ql, qr)); } } int queryY(node1 *root, int l, int r, int ql, int qr, int qly, int qry){ if(l > r || ql > qr || l > qr || r < ql) return 0; if(l >= ql && r <= qr){ if(root->in == nullptr) return 0; else return queryX(root->in, 1, N, qly, qry); } else{ int m = (l + r)/2; if(root->lc == nullptr){ root->lc = new node1(); } if(root->rc == nullptr){ root->rc = new node1(); } return __gcd(queryY(root->lc, l, m, ql, qr, qly, qry), queryY(root->rc, m+1, r, ql, qr, qly, qry)); } } void init(int R, int C) { kok = new node1(); } void update(int P, int Q, long long K){ updateX(kok, 1, N, P, Q, K); } long long calculate(int P, int Q, int U, int V) { return queryY(kok, 1, N, P, U, Q, V); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccK7J4KV.o: in function `main':
grader.c:(.text.startup+0x6a): undefined reference to `init'
/usr/bin/ld: grader.c:(.text.startup+0xcc): undefined reference to `calculate'
/usr/bin/ld: grader.c:(.text.startup+0x136): undefined reference to `update'
collect2: error: ld returned 1 exit status