Submission #98833

#TimeUsernameProblemLanguageResultExecution timeMemory
98833Alexa2001Game (IOI13_game)C++17
0 / 100
3 ms384 KiB
#include "game.h" #include <bits/stdc++.h> #define left_son (node<<1) #define right_son ((node<<1)|1) #define mid ((st+dr)>>1) using namespace std; typedef long long ll; const int Nmax = 1e5 + 5; int N, M; ll ans; ll gcd2(ll X, ll Y) { if(!Y) return X; ll rest = X % Y; while(rest) X = Y, Y = rest, rest = X % Y; return Y; } class SegTree { ll a[Nmax<<2]; public: void update(int node, int st, int dr, int pos, int val) { if(st == dr) { a[node] = val; return; } if(pos <= mid) update(left_son, st, mid, pos, val); else update(right_son, mid+1, dr, pos, val); a[node] = gcd2(a[left_son], a[right_son]); } void query(int node, int st, int dr, int L, int R) { if(L <= st && dr <= R) { ans = gcd2(a[node], ans); return; } if(L <= mid) query(left_son, st, mid, L, R); if(mid < R) query(right_son, mid+1, dr, L, R); } } aint[12]; void init(int R, int C) { if(!(R <= 10 && C <= 100000)) exit(0); N = R; M = C; } void update(int x, int y, ll K) { aint[x].update(1, 0, M-1, y, K); } ll calculate(int P, int Q, int U, int V) { int i, X1, X2, Y1, Y2; X1 = min(P, U); X2 = max(P, U); Y1 = min(Q, V); Y2 = max(Q, V); ans = 0; for(i=X1; i<=X2; ++i) aint[i].query(1, 0, M-1, Y1, Y2); return ans; }

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...