Submission #1091133

#TimeUsernameProblemLanguageResultExecution timeMemory
1091133kkkkkkkkGame (IOI13_game)C++14
Compilation error
0 ms0 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; long long n, m; vector<vector<long long> > tree; long long nzd(long long a, long long b) { if (b==0) return a; return nzd(b, a%b); } long long query_y(long long kx, long long ky, long long left, long long right, long long levo_kol, long long desno_kol) { if (left>=levo_kol && right<=desno_kol) return tree[kx][ky]; else if (left>desno_kol || right<levo_kol) return 0; long long mid=(left+right)/2; long long r1=query_y(kx, 2*ky, left, mid, levo_kol, desno_kol); long long r2=query_y(kx, 2*ky+1, mid+1, right, levo_kol, desno_kol); return nzd(r1, r2); } long long query_x(long long k, long long left, long long right, long long gore_red, long long dole_red, long long levo_kol, long long desno_kol) { if (left>=gore_red && right<=dole_red) return query_y(k, 1, 0, m-1, levo_kol, desno_kol); else if (left>dole_red || right<gore_red) return 0; long long mid=(left+right)/2; long long r1=query_x(2*k, left, mid, gore_red, dole_red, levo_kol, desno_kol); long long r2=query_x(2*k+1, mid+1, right, gore_red, dole_red, levo_kol, desno_kol); return nzd(r1, r2); } void update_y(long long kx, long long left_x, long long right_x, long long ky, long long left_y, long long right_y, long long row, long long col, long long val) { if (left_y==right_y) { if (left_x==right_x) tree[kx][ky]=val; else tree[kx][ky]=nzd(tree[2*kx][ky], tree[2*kx+1][ky]); } else { long long mid=(left_y+right_y)/2; if (col>mid) update_y(kx, left_x, right_x, 2*ky+1, mid+1, right_y, row, col, val); else update_y(kx, left_x, right_x, 2*ky, left_y, mid, row, col, val); tree[kx][ky]=nzd(tree[kx][2*ky], tree[kx][2*ky+1]); } } void update_x(long long k, long long left, long long right, long long row, long long col, long long val) { if (left!=right) { long long mid=(left+right)/2; if (row>mid) update_x(2*k+1, mid+1, right, row, col, val); else update_x(2*k, left, mid, row, col, val); } update_y(k, left, right, 1, 0, m-1, row, col, val); } void init(long long r, long long c) { tree.resize(4*r, vector<long long> (4*c, 0)); n=r, m=c; } void update(long long r, long long c, long long br) { update_x(1, 0, n-1, r, c, br); } long long calculate(long long x1, long long y1, long long x2, long long y2) { long long rez=query_x(1, 0, n-1, x1, x2, y1, y2); return rez; } /* int main() { init(2, 3); update(0, 0, 20); update(0, 2, 15); update(1, 1, 12); cout << calculate(0, 0, 0, 2) << endl; cout << calculate(0, 0, 1, 1) << endl; update(0, 1, 6); update(1, 1, 14); cout << calculate(0, 0, 0, 2) << endl; cout << calculate(0, 0, 1, 1) << endl; return 0; }*/

Compilation message (stderr)

/usr/bin/ld: /tmp/cc5Ervaq.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