Algorithm 最多2次重叠的区间选择算法
我正在尝试求解,其中N(我不确定这个方向是否有效,因为可能是在添加新的间隔时,我们不能添加到以前的解决方案中,而是必须完全改变情况。@redtuna我确信只有a[I]这还不够,但是……你还有其他想法吗?当然,我会尝试一种贪婪启发式的搜索算法。是的,我只会在找到DP解决方案后才尝试贪婪,因为问题列在“动态”类别中。可能有贪婪的保证解决方案,而不仅仅是启发式的。@AndreiI你能解决这个问题吗?Algorithm 最多2次重叠的区间选择算法,algorithm,dynamic-programming,Algorithm,Dynamic Programming,我正在尝试求解,其中N(我不确定这个方向是否有效,因为可能是在添加新的间隔时,我们不能添加到以前的解决方案中,而是必须完全改变情况。@redtuna我确信只有a[I]这还不够,但是……你还有其他想法吗?当然,我会尝试一种贪婪启发式的搜索算法。是的,我只会在找到DP解决方案后才尝试贪婪,因为问题列在“动态”类别中。可能有贪婪的保证解决方案,而不仅仅是启发式的。@AndreiI你能解决这个问题吗? A[i] = 1 + A[q[i]] + [missing-part]; //1 stands for
A[i] = 1 + A[q[i]] + [missing-part];
//1 stands for the i-th interval
//A[q[i]] stands for the solution of the intervals that do not overlap with with the i-th interval
//[missing-part] is the maximum number of intervals from the intervals that overlap with the i-th intervals that are safe to be added.