数列排序组合的一个算法问题,是怎么采用的C语言的程序的编写的设计的过程的方式的技术去实现呢

Problem Description
  Cut or not to cut, it is a question.
  In Fruit Ninja, comprising three or more fruit in one cut gains extra bonuses. This kind of cuts are called bonus cuts.
  Also, performing the bonus cuts in a short time are considered continual, iff. when all the bonus cuts are sorted, the time difference between every adjacent cuts is no more than a given period length of W.
  As a fruit master, you have predicted the times of potential bonus cuts though the whole game. Now, your task is to determine how to cut the fruits in order to gain the most bonuses, namely, the largest number of continual bonus cuts.
  Obviously, each fruit is allowed to cut at most once. i.e. After previous cut, a fruit will be regarded as invisible and won't be cut any more.
  In addition, you must cut all the fruit altogether in one potential cut. i.e. If your potential cut contains 6 fruits, 2 of which have been cut previously, the 4 left fruits have to be cut altogether.

Input
  There are multiple test cases.
  The first line contains an integer, the number of test cases.
  In each test case, there are three integer in the first line: N(N<=30), the number of predicted cuts, M(M<=200), the number of fruits, W(W<=100), the time window.
  N lines follows.
  In each line, the first integer Ci(Ci<=10) indicates the number of fruits in the i-th cuts.
  The second integer Ti(Ti<=2000) indicate the time of this cut. It is guaranteed that every time is unique among all the cuts.
  Then follow Ci numbers, ranging from 0 to M-1, representing the identifier of each fruit. If two identifiers in different cuts are the same, it means they represent the same fruit.

Output
  For each test case, the first line contains one integer A, the largest number of continual bonus cuts.
  In the second line, there are A integers, K1, K2, ..., K_A, ranging from 1 to N, indicating the (Ki)-th cuts are included in the answer. The integers are in ascending order and each separated by one space.  If there are multiple best solutions, any one is accepted.

Sample Input
1
4 10 4
3 1 1 2 3
4 3 3 4 6 5
3 7 7 8 9
3 5 9 5 4

Sample Output
3
1 2 3

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

2
求数列的和,用C语言,谢谢
1
C语言求数列的的第n项的和
2
求解一个和平方数列求和有关的解法的问题,采用C语言解决这个问题的思路实现怎么做?
1
一个数列数组的求和再求比率的问题,如何利用C语言的方法编程算法解决
0
综合运用C语言的编程的技术如何解决这里的数列求和的算法问题呢
0
如何利用C语言编程实现对数列的搜索问题,采用C语言代码的编写的方式是怎么做?
0
数列的倍增的一个算法题目的求解的过程,如何利用C语言的计算的编程?
0
数列累积核的问题,数据结构的算法怎么利用C语言的形式实现
0
二进制线段数列的枚举的典型问题,使用C语言编写程序设计解决这个算法是怎么做的
0
菲波那契数列(Fibonacci numbers)的一个算法问题,运用C语言实现的形式和做法
0
数列的翻转表的一个算法的问题的求解,用C语言的程序编写怎么实现的啊
0
数列数组的增加删除修改寻找的一个问题,采用C语言的程序设计的方式怎么实现代码的编写
0
序列上截取一个最大的和的连续数列的问题,怎么采用C程序的语言设计的办法
0
提取数列中的因子的一个算法问题,怎么利用C语言的程序的计算的方式实现?
0
反推递增数列的一个算法的思路问题,怎么采用C语言的程序的设计的思想实现?
0
数列删除+求合的算法怎么利用C语言的程序的设计的思想是现代码的编写的呢?
0
数列的整理的一个算法的运算,怎么采用C程序的语言的代码的编写的技术来实现?
0
数列分段判断的算法问题求解,怎么利用C语言的程序设计思想的方式去实现算法呢?
0
根据输入组输出该数列的和,怎么是利用 C 语言的程序编写的技术办法的思想去实现呢?
0
数列用函数的推导的计算问题,如何采用C语言的程序的代码编写技巧和思想方法来解决这个问题