if __name__=='__main__': def trans(nums): a1,a2,a3,a4,a5,a6=nums ans=[ [a1,a2,a3,a4,a5,a6],[a4,a3,a1,a2,a5,a6],[a3,a4,a2,a1,a5,a6],[a2,a1,a4,a3,a5,a6], [a1,a2,a4,a3,a6,a5],[a2,a1,a3,a4,a6,a5],[a4,a3,a2,a1,a6,a5],[a3,a4,a1,a2,a6,a5], [a1,a2,a5,a6,a4,a3],[a2,a1,a6,a5,a4,a3],[a5,a6,a2,a1,a4,a3],[a6,a5,a1,a2,a4,a3], [a1,a2,a6,a5,a3,a4],[a2,a1,a5,a6,a3,a4],[a5,a6,a1,a2,a3,a4],[a6,a5,a2,a1,a3,a4], [a4,a3,a5,a6,a2,a1],[a3,a4,a6,a5,a2,a1],[a5,a6,a3,a4,a2,a1],[a6,a5,a4,a3,a2,a1], [a4,a3,a6,a5,a1,a2],[a3,a4,a5,a6,a1,a2],[a5,a6,a4,a3,a1,a2],[a6,a5,a3,a4,a1,a2] ] ans_str=[] for ass in ans: ans_str.append(''.join([str(a) for a in ass])) return min(ans_str) n=int(input()) from collections import defaultdict cnt=defaultdict(int) for _ in range(n): nums=list(map(int,input().split())) alpha=trans(nums) cnt[alpha]+=1 print(len(cnt.keys())) print(' '.join(str(num) for num in sorted(cnt.values(),reverse=True)))
全部评论
(6) 回帖