# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
514829 | ritul_kr_singh | Game (IOI13_game) | C++17 | 3585 ms | 233088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
#define ll long long
#define m ((l + r) / 2)
const int N = 6e5, M = 1.3e7, B = 25;
ll gcd2(ll X, ll Y) {
while(X != Y && Y) swap(X %= Y, Y);
return X;
}
int limRow, limCol, sL, sR; ll sV;
ll sGcd[M], xGcd[N*B];
int G[M], H[M], sCnt, xCnt, xP[N*B], xRow[N*B];
void sUpd(int l, int r, int u) {
if(r - l < 2) return void(sGcd[u] = sV);
sL<m? sUpd(l, m, G[u] ? : G[u] = ++sCnt):
sUpd(m, r, H[u] ? : H[u] = ++sCnt);
sGcd[u] = gcd2(G[u] ? sGcd[G[u]] : 0LL, H[u] ? sGcd[H[u]] : 0LL);
}
ll sQry(int l, int r, int u) {
if(sL<=l && r<=sR) return sGcd[u];
if(sR<=l || r<=sL) return 0LL;
return gcd2((G[u] ? sQry(l, m, G[u]) : 0LL),
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |