MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / yo

Function yo

Data Structures/Sparse Table 2D.cpp:9–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7int a[N][N], lg2[N];
8
9int yo(int x1, int y1, int x2, int y2) {
10 x2++;
11 y2++;
12 int a = lg2[x2 - x1], b = lg2[y2 - y1];
13 return max(
14 max(st[x1][y1][a][b], st[x2 - (1 << a)][y1][a][b]),
15 max(st[x1][y2 - (1 << b)][a][b], st[x2 - (1 << a)][y2 - (1 << b)][a][b])
16 );
17}
18
19void build(int n, int m) { // 0 indexed
20 for (int i = 2; i < N; i++) lg2[i] = lg2[i >> 1] + 1;

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected