We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference: Codeforces by Franchesco_virgoliniiii
struct RMQ { vector<vector<int>> table; RMQ(vector<int> &v) : table(20, vector<int>(v.size())) { int n = v.size(); for (int i = 0; i < n; i++) table[0][i] = v[i]; for (int j = 1; (1<<j) <= n; j++) for (int i = 0; i + (1<<j-1) < n; i++) table[j][i] = max(table[j-1][i], table[j-1][i + (1<<j-1)]); } int query(int a, int b) { int j = 31 - __builtin_clz(b-a+1); return max(table[j][a], table[j][b-(1<<j)+1]); } };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Reference: Codeforces by Franchesco_virgoliniiii
The text was updated successfully, but these errors were encountered: