제출 #437357

#제출 시각아이디문제언어결과실행 시간메모리
437357Eric_hoo웜뱃 (IOI13_wombats)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define W(x) ((x) ? (x)->w : 0) #define ID(x, y) (((long long)(x) << 30) + (y)) using namespace std; inline long long gcd(long long x, long long y) { while (x && y) { if (x > y) x = x % y; else y = y % x; } return x | y; } struct Node { long long x; long long y, w; int fix; Node *lson, *rson; Node() {fix = rand(), lson = rson = NULL;} void pushup() {w = gcd(y, gcd(W(lson), W(rson)));} }NODEPOOL[700000], *NODECUR = NODEPOOL; Node *merge(Node *l, Node *r) { if (!l || !r) return l ? l : r; if (l->fix > r->fix) { l->rson = merge(l->rson, r); l->pushup(); return l; } else { r->lson = merge(l, r->lson); r->pushup(); return r; } } void split(Node *T, long long x, Node *&l, Node *&r) { if (!T) {l = r = NULL; return ;} if (x < T->x) split(T->lson, x, l, r), T->lson = r, T->pushup(), r = T; else split(T->rson, x, l, r), T->rson = l, T->pushup(), l = T; } void Insert(Node *&T, int x, int y, long long w) { Node *t1, *t2, *t3; split(T, ID(y, x - 1), t1, t2), split(t2, ID(y, x), t2, t3); if (!t2) t2 = NODECUR++; t2->x = ID(y, x), t2->y = t2->w = w; T = merge(t1, merge(t2, t3)); } long long Query(Node *T, int l, int r) { Node *t1, *t2, *t3; split(T, ID(l, -1), t1, t2), split(t2, ID(r + 1, -1), t2, t3); long long ans = W(t2); T = merge(t1, merge(t2, t3)); return ans; } struct Seg { Node *T; Seg *lson, *rson; Seg() {T = NULL, lson = rson = NULL;} }SEGPOOL[700000], *SEGCUR = SEGPOOL, *T = NULL; void Update(Seg *&T, int l, int r, int x, int y, long long w) { if (!T) T = SEGCUR++; Insert(T->T, x, y, w); if (l == r) return ; int mid = l + r >> 1; if (x <= mid) Update(T->lson, l, mid, x, y, w); else Update(T->rson, mid + 1, r, x, y, w); } long long Query(Seg *T, int l, int r, int L, int R, int LL, int RR) { if (!T) return 0; if (l == L && r == R) return Query(T->T, LL, RR); int mid = l + r >> 1; if (R <= mid) return Query(T->lson, l, mid, L, R, LL, RR); if (L > mid) return Query(T->rson, mid + 1, r, L, R, LL, RR); return gcd(Query(T->lson, l, mid, L, mid, LL, RR), Query(T->rson, mid + 1, r, mid + 1, R, LL, RR)); } int N, M, Q; void read(int &x) { char c = getchar(); while (c < '0' || c > '9') c = getchar(); x = c - '0', c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); } void read(long long &x) { char c = getchar(); while (c < '0' || c > '9') c = getchar(); x = c - '0', c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); } char st[100]; void print(long long x) { int tp = 0; if (!x) st[tp++] = '0'; while (x) st[tp++] = x % 10 + '0', x /= 10; while (tp--) putchar(st[tp]); putchar('\n'); } void init(int R, int C) { N = R, M = C, srand(2333); } void update(int x1, int y1, long long w) { x1++, y1++; Update(T, 1, N, x1, y1, w); } long long calculate(int x1, int x2, int y1, int y2) { x1++, x2++, y1++, y2++; return Query(T, 1, N, x1, y1, x2, y2); }

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

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
wombats.cpp: In function 'void Update(Seg*&, int, int, int, int, long long int)':
wombats.cpp:69:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   69 |  int mid = l + r >> 1;
      |            ~~^~~
wombats.cpp: In function 'long long int Query(Seg*, int, int, int, int, int, int)':
wombats.cpp:77:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   77 |  int mid = l + r >> 1;
      |            ~~^~~
/usr/bin/ld: /tmp/ccuYzaQx.o: in function `main':
grader.c:(.text.startup+0x129): undefined reference to `init'
/usr/bin/ld: grader.c:(.text.startup+0x194): undefined reference to `escape'
/usr/bin/ld: grader.c:(.text.startup+0x203): undefined reference to `changeH'
/usr/bin/ld: grader.c:(.text.startup+0x26d): undefined reference to `changeV'
collect2: error: ld returned 1 exit status