题解 | #数据分类处理#
数据分类处理
https://www.nowcoder.com/practice/9a763ed59c7243bd8ab706b2da52b7fd
I = input().split() R = input().split() I_arr = I[1: int(I[0])+1] R_arr = sorted(list(set([int(x) for x in R[1:int(R[0])+1]]))) out = [] for ri in R_arr: p = [[i,x] for i,x in enumerate(I_arr) if str(ri) in x] if len(p) >0: out = out + [str(ri),str(len(p))]+[str(element) for row in p for element in row] print(len(out),' '.join(out))