예제 #1
0
        static int BSearchR(SegmentTreeCompare treec, SegmentTreeCompare treed, int l, int r, int max, int max2)
        {
            int ii = l;

            while (r >= l)
            {
                int mid = (l + r) / 2;
                if (treec.Value(ii, mid) <= max && treed.Value(ii, mid) < max2)
                {
                    l = mid + 1;
                }
                else
                {
                    r = mid - 1;
                }
            }

            return(r);
        }
예제 #2
0
        static int BSearchL(SegmentTreeCompare treec, SegmentTreeCompare treed, int l, int r, int max, int max2)
        {
            int ii = r;

            while (r >= l)
            {
                int mid = (l + r) / 2;
                if (treec.Value(mid, ii) <= max && treed.Value(mid, ii) < max2)
                {
                    r = mid - 1;
                }
                else
                {
                    l = mid + 1;
                }
            }

            return(l);
        }