标签:algo pac dep ORC clu force 包含 之一 回文
#include <cstdio>
#include <algorithm>
using namespace std;
int l1, l2, r1, r2;
int Divide(int a, int b, int c, int d, int depth) {
if (a > b || c > d) return 0;
int res = max(0, min(b, d) - max(a, c) + 1);
if ((a <= c && b >= d) || (c <= a && d >= b)) return res;
int mid = 1 << depth;
int x[2], y[2], s[2], t[2];
x[0] = min(a, mid), y[0] = min(b, mid - 1);
x[1] = max(a, mid + 1) - mid, y[1] = max(b, mid) - mid;
s[0] = min(c, mid), t[0] = min(d, mid - 1);
s[1] = max(c, mid + 1) - mid, t[1] = max(d, mid) - mid;
res = max(res, Divide(x[0], y[0], s[0], t[0], depth - 1));//ll
res = max(res, Divide(x[0], y[0], s[1], t[1], depth - 1));//lr
res = max(res, Divide(x[1], y[1], s[0], t[0], depth - 1));//rl
res = max(res, Divide(x[1], y[1], s[1], t[1], depth - 1));//rr
return res;
}
int main() {
scanf("%d %d %d %d", &l1, &r1, &l2, &r2);
return !printf("%d\n", Divide(l1, r1, l2, r2, 30));
}
标签:algo pac dep ORC clu force 包含 之一 回文
原文地址:https://www.cnblogs.com/AlphaWA/p/10854012.html